18-10-2012, 04:44 PM
Hypertext Pre−Processor
(ebook) PHP - How To.pdf (Size: 143.38 KB / Downloads: 17)
Introduction
PHP stands for 'Hypertext Pre−Processor' and is a server side HTML scripting/programming language. PHP
is a tool that lets you create dynamic web pages. PHP−enabled web pages are treated just like regular HTML
pages and you can create and edit them the same way you normally create regular HTML pages.
PHP was kept the "top secret and strictly confidential" computer language by many companies in the
world, but now had become the most well−known and most widely used scripting language for web, internet,
e−commerce and business−to−business projects. Even today many competing companies keep PHP language
as a highly confidential matter not disclosing to outsiders (competitors).
PHP will storm the entire world and will take the IT industry by surprise!! The power of PHP is that it is
cross−platform and runs everywhere!! It runs on Linux, Windows 95/98/NT, Windows 2000, Solaris,
HPUX and all flavors of unix. PHP is write once and deploy anywhere and everywhere. It runs on many
web−servers like Apache, Microsoft IIS, etc..
PHP runs 5 to 20 times faster than Java!! It is extremely easy to use and you can develop very complex
web/e−commerce applications very rapidly in a very short period of time.
It has object oriented features and takes the best features from Java, C++, PERL and "C" langauges. PHP
language is a marriage of best features from Java, C++, PERL and C.
PHP is the real gem of all the scripting/programming languges and will soon become the "MECCA" for
programmers world−wide!! PHP has a huge user base and a large developer base as it runs on both
window95/NT and all flavors of unixes.
PHP can be compiled and optimized to make it run even faster by using the Zend Optimizer. Zend optimizer
is integrated with PHP in PHP version 4.0.
You would normally use a combination of PHP (70% code) + HTML/DHTML/XML (25% code) +
Javascript (5% code client side validations) for your e−commerce projects.
PHP Tutorial
Note that this is not like a CGI script. Think of it as a normal HTML file which happens to have a set of
special tags available to you.
If you tried this example and it didn't output anything, chances are that the server you are on does not have
PHP enabled. Ask your administrator to enable it for you.
The point of the example is to show the special PHP tag format. In this example we used < ?php to indicate
the start of a PHP tag. Then we put the PHP statement and left PHP mode by adding the closing tag, ? > .
You may jump in and out of PHP mode in an HTML file like this all you want.
We are going to check what sort of browser the person viewing the page is using. In order to do that we check
the user agent string that the browser sends as part of its request. This information is stored in a variable.
Variables always start with a dollar−sign in PHP. The variable we are interested in is
$HTTP_USER_AGENT. To display this variable we can simply do:
Limitations of PHP
Everything has limitations or disadvantages and PHP is no exception. The following are the limitations of
PHP (so be WARNED !!)
1. PHP is NOT 100 % pure Object Oriented scripting language. PHP is good if your PHP code size does
not exceed 3,00,000 lines. Maintainence of PHP code greater than 1,00,000 lines becomes more
difficult.
2. PHP will NOT give the performance of "C" or "C++" language. Because it is scripting language and
is interpreted it will be a bit slower than the optimized "C++" programs. For top performance, you
should use "C++" and fast−CGI with database/webserver connection pooling and use C++ compiler
optimizer "−O3" options. Zend optimizer in PHP 4 will speed up the performance of PHP to certain
extent.
On the other hand, PHP has lot of advantages and it's advantages outweigh it's limitations −
1. You can very rapidly develop web applications in PHP as compile and link is eliminated in PHP
scripting language.
2. PHP applications are very stable and do not depend on the browser technologies unlike Javascript
applications which depend on browsers. PHP will give you the freedom to select any server platform
and browser does not know that the HTML page is generated by PHP!!
3. PHP has excellent database conectivity to all SQL database servers.
4. PHP has partial support for Object oriented features
5. PHP has C++, Perl, Javascript like syntax features and has programs like 'ptags/ctags' to navigate the
source code
6. PHP has Zend optimizer which speeds up the performance
7. PHP runs on all unixes, linux, Windows 95/NT/2000 and is more powerful than ASP, JSP and others.
8. PHP has a very large user base and developer base.