Compare: PHP vs Python


I. Similar
  • They are advance language, dinamic compile and set type.
  • Open source
  • Developer community is very large
  • Easier to learn with Java, C or Perl
  • Easier to expansion with Java C++
  • Very portability, run on many platform without recompile code or fix code
II. Defference
1. Advantage of PHP:
  • PHP inherit curly braces to mark code block of C and & sign of Perl
  • switch and do...while statements
  • =, ++ and -- operator
  • ...?... : .... statement
  • Very strong array, use for list and dictionary
  • Referenced ('$a =&$b' : when $b had been change, $a will be change too)
  • There are both private, protected and public access modifiers for methods and properties
  • Using both abstract and final modifiers for classes and methods
  • Interfaces
  • $this is default object and don't need to reverse 'self' to define method as Python
  • Support to code multiline
  • Diversity comment (#, /* */ or //)
2. Advantage of Python
  • It's a language for general purpose (Python can use to make almost things, when PHP only use in web develop or console. Of cource, PHP can use in other, but it's trivial)
  • Using indentation replace curly braces to mark code block. (Of cource, it's more beautiful but it's not friendly with HTML template of Web)
  • There are namespaces and modules(PHP 5.3 have namespaces)
  • Transfer variable to function more effective than PHP by key=value pair, better support for default value of variable transfer to function
  • Apply to multi inheritance
  • Instropection better than PHP Reflection
  • Every thing from variable to object ares reference type
  • There is Threading
  • Document better than PHP (but certainly, it's less TUT, Guide, comment,... than PHP)
  • Can GUI programming (Of course PHP can but can not equal)
  • Can run on .Net with IronPython or Java platform with Jython (PHP can also run on Java, even in all of Application Server)
  • There are web server, private application server, 100% code by Python
  • There are lambdas and support functions to build functions (PHP have create_function and closure)
  • Cached byte-code (PHP also have, but not equal)
  • Support unicode better than PHP
  • Exception error control better
  • Run faster than PHP (The truth is run faster but use more CPU and RAM)

Share this

Related Posts

Previous
Next Post »