Perbandingan Python dan PHP

pesan sponsor

Info Franchise di Indonesia
BursaFranchise.com Pusat informasi franchise / waralaba dan peluang bisnis Indonesia

Langganan Majalah Gratis!
FreeMagazine Dapatkan majalah internasional berbagai bidang GRATIS. Daftar segera!

Web hosting Murah cuma Rp100/bulan
www.HostGator.com Ingin punya blog sendiri? Beli hostingnya disini. Gunakan COUPON code 404page

Untuk membuat suatu web application kita bisa menggunakan bahasa pemrograman Python atau PHP. Lalu, pakai yang mana ? Kita harus mengenal perbedaan keduanya. Jika Anda melihat URL web yang menggunakan PHP, maka akan terlihat ekstensi .php di URLnya, sedangkan Python bisa URLnya tidak berekstensi.

Yang dimiliki PHP, tapi tidak ada di Python

* syntax 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 (… ? … : …)
* schizophrenic 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.
* a very casual language, where globals are often used to pass arguments, all variables are “set” (to NULL), and a somewhat weak type system (not to be confused with dynamic types)
* an expedient (commonly installed) environment
* aliases (‘$a =& $b’ means that when $b changes, $a changes also) (should be “references”, not “aliases)
* one array type that doubles as a list and a dictionary. Dictionary keys are iterated in their original order.
* (An EXCELLENT on-line Manual)

Yang dimiliki Python, tidak dimiliki PHP

* a general purpose programming language (not just for the web) (not true PHP has a CLI SAPI, and is embeddable)
* indentation is used to mark out block structure rather than curly braces
* namespaces and modules
* a small core
* very clear, concise, and orthogonal syntax
* it is self documenting with docstrings and pydoc (PHP 5 has reflection and doc strings)
* keyword arguments to functions and methods, easy support for default arguments
* true object orientation and ‘first class’ classes and functions (OO has been completely revamped in PHP 5)
* classes are used extensively in the standard library
* a notion of private attributes (PHP 5 supports this)
* multiple inheritance
* object-oriented file handling
* method chaining
* excellent introspection (PHP 5 Reflection)
* everything is a reference! (references are painful in PHP) (Not in PHP 5)
* one ‘del’ statement for all data types. PHP has ‘unset’ for variables and something else for array members. (Array members can be unset())
* consistent case sensitivity (PHP does for variables, but not functions) (Functions are case insensitive)
* a simple array slicing syntax
* lambdas and other builtin functional programming constructs (php.net/create_function)
* iterators (PHP 5)
* structured exception handling (PHP 5)
* operator overloading
* SWIG? integration
* threading
* an excellent profiler, plus several debuggers and IDEs (PHP has had this for a long time)
* lots of high-level data types (lists, tuples, dicts, mx.DateTimes, NumPy arrays, etc.)
* differentiation between arrays (lists) and associative arrays (dictionaries).
* dates that aren’t limited to UNIX timestamps (<1970, >2038)
* cached byte-code compilation (available for $980 in PHP!) (pecl.php.net/apc — FREE)
* a standardized database API (pecl.php.net/PDO — PHP 5.1)
* support for all major GUI frameworks
* strong internationalization and UNICODE support (Available in PHP 5)
* maturity, stability and upward-compatibility (PHP is stable, mature and up/backward-compatible)
* tends 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.

  1. 6 Responses to “Perbandingan Python dan PHP”

  2. Nov 10, 2005 7:41 pm

    ha ha ha… cuma html doang yah… gak sebanding dong ama yg di jurusan bisa php, perl, dll. lagian blog gw udah rada terkenal, pagerank nya udah tiga loh, sehari bisa belasan pengunjung dateng(IP Unik) dari google :)

    aryaki

    Nov 15, 2005 12:14 pm

    cieeee….yg web nya terkenal slameett yeeee
    yg naikkin rating nya PSK :P

    Mar 31, 2006 8:54 pm

    Comment sama isi kok gak nyambung sih? post nya bisa lebih dulu dari commentnya?

    Mar 31, 2006 9:20 pm

    Eh, maksud gw kok comment lebih dulu dari postnya? :d

    btw, kapok gw buka blog lo pake opera, iklannya udah makin gak ketulungan :)

    Adang Sujana

    Jun 13, 2007 10:30 am

    Apakah python dan PHP sama fungsinya ? selama ini saya kenal PHP sih untuk pembuatan WEB, sementara Pyton untuk pemrograman berbasis PC.

    Feb 28, 2009 10:44 pm

    untuk urusan web PHP belum ada duanya..

    dr49on’s last blog post..Khasiat Buah Merah

Post a Comment