Chapter 3. Introduction to PHP
In Chapter 1, I explained that PHP is the language that you use to make the server generate dynamic outputâoutput that is potentially different each time a browser requests a page. In this chapter, youâll start learning this simple but powerful language; it will be the topic of the following chapters up through Chapter 7.
I encourage you to develop your PHP code using one of the IDEs listed in Chapter 2, or a good code editor.
Many of these programs will let you run the PHP code and see the output discussed in this chapter. Iâll also show you how to create PHP code so that you can see what the output looks like in a web page (the way your users will ultimately see it). But that step, as thrilling as it may be at first, isnât really important at this stage.
In production, your web pages will be a combination of PHP, HTML, JavaScript, and some MySQL statements laid out using CSS. Furthermore, each page can lead to other pages to provide users with ways to click through links and fill out forms. We can avoid all that complexity while learning each language, though. Focus for now on just writing PHP code and making sure that you get the output you expectâor at least that you understand the output you actually get!
Incorporating PHP Within HTML
By default, PHP documents end with the extension .php. When a web server encounters this extension in a requested file, it automatically passes it to the PHP processor. Of course, web servers are ...
Get Learning PHP, MySQL & JavaScript, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.