What's Hot

    What To Do If You Are £100 Short This Month

    What Is FX Futures?

    An Expat’s Guide To Moving To Canada

    Facebook Twitter Instagram
    Facebook Instagram
    Dir Book
    • Home
    • Business

      What To Do If You Are £100 Short This Month

      June 30, 2022

      What Is FX Futures?

      April 22, 2022

      Estimating The Costs Of A House Construction

      March 21, 2022

      Why Do People Choose To Live On Long Island?

      March 21, 2022

      How Long Does An Amazon A To Z Claim Take?

      February 4, 2022
    • Internet
    • Education
    • SEO
    • About
    • Contact
    Dir Book
    Home»Hardware and Software»Programming»Java vs Php
    Programming

    Java vs Php

    AngelineBy Angeline4 Mins Read
    Facebook Twitter

    Java vs Php[Language Features]

    Feature Data types

    (adsbygoogle = window.adsbygoogle || []).push({});

    PHP boolean, integer, float, string, array, object.
    Java boolean, char, byte, short, int, long, float, double, String, array, Object.
    Winner Java.
    2 Feature Variables names
    PHP Variables are represented by a dollar sign followed by the name of the variable.
    The variable name is case-sensitive.
    Java There is no special character to start the variable name. The variable name is case-sensitive.
    Winner Java.
    3 Feature Variable declaration
    PHP The variable is declared when it is created. Its type is implied from the assigned value. A variable can change its type if it is assigned a new value.
    Java Variables must be declared with a specific data type before usage.
    Winner Java. It is convenient for a small program not to require variable declarations, but for large software, this is harmful. Variables changing their types based on their value are very dangerous in large programs.
    4 Feature Global variables
    PHP PHP has a large number of predefined variables.
    Java Java does not have global variables.
    Winner Java. Global variables introduce possible bugs in large software.
    5 Feature Variable variable names. A variable that contains the name of another variable.
    PHP Supported.
    Java Not supported.
    Winner PHP.
    6 Feature Constant declaration
    PHP Constants are defined through a function, e.g.:
    define(“MYCONST”, “Hello world”);
    Defines a constant named MYCONST.
    Java Constants are declared like variables with a “static final” modifier, e.g:
    static final String MYCONST = “Hello world”;
    Winner Java. Introducing a special function to define constants is counter-intuitive.
    7 Feature Using libraries
    PHP PHP includes libraries.
    Java Java import libraries.
    Winner Java. Including libraries can introduce variable scope issues. Packages are better structured than included libraries. 8 Feature Method overloading
    PHP Not supported.
    Java Supported.
    Winner Java.
    9 Feature Passing method parameters
    PHP Passed by value and by reference.
    Java By value only.
    Winner PHP.

    10 Feature Varying number of method’s parameters

    PHP Supported.
    Java Not supported, but can be done with method overloading.
    Winner PHP.

    11 Feature Variable functions: A variable name contains the name a function to call.

    PHP Supported.
    Java Supported with reflection.
    Winner PHP. Java is harder to do.
    12 Feature Invoking class members PHP object->member()
    Java object.memeber()
    Winner Tie.

    13 Feature Multiple inheritance

    PHP Not supported.
    Java Not supported.
    Winner Tie.

    14 Feature Static methods

    PHP ClassName::method()
    Java Method must be declared static then called as follows:
    ClassName.method()
    Winner Tie.
    15 Feature Object serialization
    PHP Supported. Serializes to a stream.
    Java Supported. Serializes to a stream or to XML. Winner Java.
    16 Feature Interfaces
    PHP Not supported.
    Java Supported.
    Winner Java.
    17 Feature Scope of class members
    PHP Only default public scope.
    Java public, private, protected, and default (package).
    Winner Java.
    18 Feature Polymorphism
    PHP Not supported. Methods cannot be overridden.
    Java Supported.
    Winner Java.
    19 Feature Abstract classes and methods
    PHP Not supported.
    Java Supported.
    Winner Java.
    20 Feature Exception handling
    PHP Errors can be ignored or raised.
    Java Structured handling with try/catch/finally construct.
    Winner Java.
    21 Feature Multiple threads processing
    PHP Not supported. (Supports Unix style process control with an add-on library that works on Unix only).
    Java Supported.
    Winner Java.
    22 Feature Components
    PHP Not supported.
    Java Supported with Java Beans and EJBs.
    Winner Java.
    23 Feature Security
    PHP Limited support with the “safe mode” feature.
    Java Detailed support for applets, servlets, EJBs, and applications.
    Winner Java.

    4 Conclusion
    The following shows the scores for each language:

    Number of feature 21
    PHP Won 3
    Java Won 15
    Tie 3

    PHP is suitable for small web based applications. Notice how PHP won in features that are geared towards the script’s writer, e.g. Variable variable name, or multi-line strings.

    No related posts.

    Share. Facebook Twitter

    Leave A Reply Cancel Reply

    • Latest Post

    What To Do If You Are £100 Short This Month

    What Is FX Futures?

    An Expat’s Guide To Moving To Canada

    A Guide to Moving to Canada

    Follow On Instagram
    RSS Blog Feed
    • Will the next iPhone charge wirelessly?
    • How 'America First' could turn into to 'India First'
    • Mexico ready to retaliate by hurting US farmers
    • Stocks hit record again. Is Trump the reason?
    • Apple stock nears record high
    About Me

    I’m Angeline (P.S. my friends call me Angie), a DIY and home interior obsessed US girl, and keen lover of travel, fashion, love and Italian food.I love travelling, enjoying amazing food and wine and style of all kinds. This is my happy place and really a creative corner of the world to share my simple, complex, entertaining and inexpensive projects, colourful lifestyle, budget travels ideas.

    Facebook Instagram
    Services
    • Construction and Maintenance
    • Consumer Goods and Services
    • Communications
    • Computers
    • Internet
    Coverage
    • Transportation and Logistics
    • safety and security
    • Software
    • Mobile-Cell-Phone
    • Business Services

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

      Copyright © 2006-2021 Dir Book.

      Type above and press Enter to search. Press Esc to cancel.