Chapter 2: What Is PHP? |
|
Definitions | |
|
PHP - PHP: Hypertext Pre-processor. If that sounds a bit circular...well, it is. PHP originally stood for Personal Home Page and was a set of Perl scripts written to track the hits on a home page. However, it has grown up into an amazingly powerful language. PHP is an interpreted language (like BASIC from the Dark Ages of computing). It is handled by a command processor which determines the meaning of each line as it reads the script. Errors that would keep the script from running will be detected during this time. The command processor will display messages telling you what to fix. Despite being processed by this other software before actually running, PHP is very fast. PHP is rapidly becoming the language of choice for Web developers. It's easy to read a PHP script if you have any experience with a structured programming language such as Perl or C++. In fact, if you've used Perl, you're 80% of the way to using PHP already. (Lucky you!) But don't be nervous if you haven't programmed before. I'll do my best to make it easy for you to learn. |
|
Why use PHP? |
|
As I just mentioned, PHP is fast, easy and relatively simple. Its string-handling capabilities make it a great choice for processing information from forms, producing customized Web pages and much more. It can do math operations, talk to databases, manage lists of items and many other tasks using very little code. Since it supports functions, you can reuse blocks of code from earlier scripts in a new script. See Chapter 11: Using Functions for more about this topic. Another good reason is availability. Almost every modern Web server has a copy of the PHP interpreter installed. This is partly because it's free. PHP is supported, maintained and improved by a community of users and programmers. It is made available under the GNU General Public License. Server administrators don't have to buy PHP and keep paying for every upgrade. That's a great incentive to keep a current version of PHP on their computers. Another reason to program in PHP is that it's pretty easy to learn. You can pick up the basics in two hours and learn more advanced elements when you need them. You can go to the PHP home page and search for a topic that interests you. Chances are good that a script or a module has already been written which you can use right now. Within minutes, you can be reading the code of a script that does some or all of what you need for your current project. If it can be used "as is" just download it and use it. Or, if some part of it solves a small problem in a larger project, grab the that part of the code, paste it into your script and make whatever adjustments may be needed. Often it's just a matter of matching a few variable names so the new code fits right in with yours. |
| Previous Page Table of Contents Next Page |
Copyright © 2004 Steve Humphrey |