What PHP Can Do For You
The World Wide Web can be a mysterious place. New technologies appear, often with little or no documentation or support. With the alphabet soup of acronyms out there--representing scripting languages and operating systems that change almost daily--it’s easy to become overwhelmed.
Take the growth of open source software, programs that are free to anyone to distribute and improve upon. Open source software gives you the power and flexibility to create your own customized products, but they can be difficult to learn. They often lack beginner’s manuals and easy-to-follow guides. As a result, these powerful technologies aren’t as popular as they deserve to be. One example: PHP, an open source Web-scripting language and wonderfully utilitarian tool that, despite its value and general ease of use, has been daunting to pick up, until now.
Read on for what PHP can do for you--and why you shouldn’t be scared of it.
What is PHP?
PHP was created in 1994 by Rasmus Lerdorf to track the visitors to his online résumé; thus, it originally stood for “Personal Home Page. ” As its capabilities grew (and as more people started to use it), it came to stand for “PHP: Hypertext Preprocessor,” which basically means that PHP handles data before it becomes HTML (HyperText Markup Language).
According to the official PHP Web site, PHP is “a server-side, cross-platform, HTML embedded scripting language. ” This may sound like a mouthful, but it’s fairly straightforward and meaningful when broken down into its parts.
Figure 1 This is the current appearance of the official PHP Web site, located at www.php.net. Naturally this should be the first place to look for most of your PHP questions and curiosities. It contains the latest edition of the PHP manual with other user comments added, as well as links to more resources.
First, server-side refers to the fact that everything PHP does occurs on the server (as opposed to on the client, which is the Web site viewer’s computer). A server is simply a special computer that houses the pages that you see when you go to a Web address with your browser.
PHP is cross-platform, meaning that it can be used on machines running almost any operating system--Unix, Windows NT, Macintosh, OS/2, to name the most popular ones. Again, that’s the server’s operating system, not the client’s. Not only that, but unlike with most other programming languages, your work can be switched from one platform to another with very few or no modifications.
To say that PHP is HTML embedded means you can put it into your HTML code--HTML being the code with which all Web pages are built. Therefore, scripting with PHP can be only slightly more complicated than hand-coding HTML. If you can make a basic HTML Web page, you can make a dynamic one, too.
Last, PHP is a scripting language, as opposed to a programming language. This means that PHP is designed to do something only after an event occurs; for example, when a user submits a form or goes to a URL. Programming languages such as Java, C, and Perl can write standalone applications, while PHP cannot. The most popular Web scripting language is JavaScript, which commonly handles events that occur within the browser (for example, when a mouse goes over an image), and is not dissimilar to PHP, although JavaScript is a client-side technology. In fact, if you can already work with JavaScript, you won't have a problem mastering PHP.