php vs. python. similarities are interpreted, high level languages with dynamic typing are open...

18
PHP vs. Python PHP vs. Python

Upload: shanon-tucker

Post on 19-Jan-2016

226 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

PHP vs. PythonPHP vs. Python

Page 2: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

SimilaritiesSimilaritiesare interpreted, high level languages

with dynamic typing are Open Sourceare supported by large developer

communities are easy to learnare 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.

Page 3: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

SimilaritiesSimilaritieshave 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.

Page 4: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What Python Differences – What Python LacksLackssyntax from C and Perl, with lots

curly braces and dollar signs the 'switch' statement and 'do ...

while' construct increment and decrement and

assignment operators (assignment is a statement only in Python)

the ternary operator/statement (... ? ... : ...)

Page 5: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What Python Differences – What Python LacksLacksschizophrenic tableau of function

names. The builtin library has a wide variety of naming conventions. There are no namespaces, so functions often have prefixes to denote their source (but often not). Functions are often placed into classes to simulate namespaces.

Page 6: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What Python Differences – What Python LacksLacksa very casual language where all

variables are "set" (to NULL), and a somewhat weak type system (not to be confused with dynamic types)

an expedient (commonly installed) environment

references ('$a =& $b' means that when $b changes, $a changes also)

Page 7: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What Python Differences – What Python LacksLacksone 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

Page 8: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksa general purpose programming

language (not just for the web) indentation is used to mark out

block structure rather than curly braces namespaces and modules

a small core very clear, concise, and

orthogonal syntax

Page 9: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksit is self documenting with

docstrings and pydockeyword arguments to functions

and methods, easy support for default arguments

true object orientation and 'first class' classes and functions

Page 10: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksclasses are used extensively in

the standard librarya notion of private attributesmultiple inheritanceobject-oriented file handling method chainingexcellent introspection

Page 11: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLackseverything is a referenceone 'del' statement for all data

types.consistent case sensitivity (PHP

functions are case insensitive, but variables are case sensitive)

a simple array slicing syntaxlambdas and other builtin

functional programming constructs

Page 12: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksiteratorsstructured exception handlingoperator overloadingSWIG integration threading an excellent profilerseveral debuggers and IDEslots of high-level data types (lists,

tuples, dicts, mx.DateTimes, NumPy arrays, etc.)

Page 13: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksdifferentiation between arrays (lists)

and associative arrays (dictionaries).

dates that aren't limited to UNIX timestamps (<1970, >2038)

cached byte-code compilationa standardized database APIsupport for all major GUI

frameworksstrong internationalization and

UNICODE support

Page 14: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

Differences – What PHP Differences – What PHP LacksLacksmaturity, stability and upward-

compatibilitytends to lead to much more

scalable applications -- importing modules is safer than textually including code as in PHP: global variables are not used to exchange information.

Page 15: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

BenchmarkingBenchmarking

Page 16: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

BenchmarkingBenchmarking

Page 17: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

ConclusionConclusionPHP’s big core uses huge amount

of resources as compared to Python.

Page 18: PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are

ReferencesReferenceshttp://xodian.net/serendipity/

index.php?/archives/27-Benchmark-PHP-vs.-Python-vs.-Perl-vs.-Ruby.html

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

http://frcchang.blogspot.com/2005/07/php-note-difference-between-php-and.html

http://www.wellho.net/mouth/67_Object-Oriented-Programming-in-PHP.html