PHP - an alternative to perl
Perl is a general purpose scripting language which we have been using to write server side scripts.
PHP is a server side scripting language specifically designed for web scripting.
Php officially stands for Php:hypertext preprocessor (even though it was originally called Professional Home Page)
As of Feb 2001 PHP is running on 5.5 million domains.
It has several similarities to perl (in fact originally it was written in perl)
- Open source, good at form processing and interfacing to databases
- Much of the command syntax is similiar.
- Available cross-platform
It advantages include
- form processing and
- interfacing to databases
- code can be embedded within the html page
The Php interpreter is installed with the webserver.
With perl you create a separate cgi file on the server
With php you can
- embed the php code inside an html page or
- like perl, write the html using php.
- any combination of the above
Similarity to perl and javascript
- All variables begin with a $ like perl
- Comments line use // like javascript
- the concatenation operator is the same as perl a .
- == is the comparison operator for values (perl uses eq for strings)
- double quotes are treated like perl, $fred=5; echo "$fred"; displays 5