Next Previous Contents

12. General purpose programming with PHP

PHP is very powerful and is designed such that it can replace awk, sed, unix shell, perl, "C", C++ and Java.

The object oriented features of PHP is developing very rapidly and in near future will surpass the object oriented features of Java language. All the object oriented features are implemented in PHP via class keyword just like in Java.

If you want to use PHP as a stand-alone program, just like a shell script, "C" or perl program, then use this technique:

bash$ php  filename.php
bash$ php -h
bash$ php -?
bash$ /usr/bin/php -?
bash$ php -i

The command php filename.php will execute the file filename.php. You are invoking the php program which you wrote in filename.php from the bash commmandline instead of from the web-browser.

On Microsoft Windows platform you will bringup a MSDOS prompt from Start->Run->cmd and put C:\Program Files\php\bin in your path environment and

C:\> php filename.php
C:\> php -h
C:\> php -?
C:\> c:\Program Files\php\bin\php filename.php

12.1 Standalone MS Windows GUI applications using PHP

Since PHP is general purpose scripting language and is like a "glue" language, you can use it develop standalone MS Windows GUI applications. PHP can be very easily combined with MS Windows C++ GUI classes to create GUI applications. And developing applications with PHP is extremely fast as it is a scripting language and it's runtime performance is also excellent as compared with other scripting languages like Perl, Visual Basic and Python.

PHP can also be used for developing standalone GUI applications for Linux/Unixes.

Next Previous Contents