What does PHP have that Python doesn’t?

zipper johnDecember 6, 20127min1800

PHP and Python are diffirent world’s but they are most popular Web programming languages in technology. Naturally both have distinct advantages and disadvantages. PHP often seems like it’s developed simply for developing Websites, even if some individuals uses of PHP for other projects also. By standard it’s really an HTML design with value placed in.

However, Python appears on as a common objective terminology. First one is used for general purpose of programming or Web Development and second one is used for web framework. Development for the website in Python includes selecting one of the web structure that gives you the performance you want. If you’re programming something different, however, it doesn’t experience like you will work against the objective of the terminology, exclusively as you can often use other general-purpose frameworks.

But in the some features both have same includes:

  • are interpreted, high level languages with dynamic typing
  • are Opensource (except where various Zend products, recommended by some, are employed)
  • are supported by large developer communities
  • are easy to learn (compared to C++, Perl)
  • are easy to extend in C, C++ and Java
  • Are extremely portable. They run on almost all platforms in existence without recompilation.
  • Support for variable number of function arguments.
  • Have the ability to freeze live objects in a string representation (for storing arbitrary objects on disk, moving them over the network, etc.); they can then be converted back to identical objects with data intact. PHP’s serialize function; Python’s pickle and marshal modules. Note that PHP, handling of serialized objects and classes is much weaker and error prone than Python’s due to PHP’s lack of modules. When an object is serialized, only its attributes are stored, not its methods. Thus, the object’s class must be present (with the exact same name) in the script that unserializes it. In Python this is handled automatically via the module/import framework. (this COULD be handled with PHP 5’s autoload(), but is not done automatically)
  • support namespaces
  • support for docstring (pydoc / reflection + phpDocumenter)
  • support method chaining
  • have several debuggers and IDEs
  • support for dates that aren’t limited to UNIX timestamps (<1970, >2038)
  • support for cached byte-code compilation (an extension in PHPs case)
  • have a standardized database API
  • support GTK and QT
  • support lambdas and other builtin functional programming constructs
  • have a single statement (unset/del) for all data types
  • can be used for scripting and general programming (CLI sapi, embedded etc., in the case of PHP)

Compared as Languages

  • syntax from C/C++ and Perl, with lots of curly braces and dollar signs and “->”-s
  • the ‘switch’ statement and ‘do … while’ construct
  • increment and decrement and assignment operators (assignment is a statement only in Python)
  • The ternary operator/statement (…?…: …)
  • Confused tableau of function names. The builtin library has a wide variety of naming conventions. Functions often have prefixes to denote their source (but often not). Functions are often placed into classes to simulate namespaces.
  • a somewhat weak type system (not to be confused with dynamic types)
  • an expedient (commonly installed) environment
  • One array type that doubles as a list and a dictionary. Dictionary keys are iterated in their original order.
  • private, protected and public modifiers for both properties and methods
  • abstract and final modifiers for both classes and methods
  • interfaces

However, as Python has multiple inheritances, there’s less need for interfaces. Also Python 2.6 has introduced Abstract Base Classes.

  • variable variables
  • default arguments in functions
  • embedding in HTML

Note: mod_python got this as well.

  • a wide range of byte-code caches available

For more help & guide line ask question with our Dedicated PHP Developer or well known PHP Development Company. We have skilled PHP Developers who provide the dedicated and approved services.

Hire PHP Developer

New Source: http://wiki.python.org/moin/PythonVsPhp