Chapter 1. PHP Basics

In This Chapter

  • Adding PHP sections to HTML files

  • Writing PHP statements

  • Using PHP variables and constants

  • Using Arrays

  • Documenting your scripts

PHP is a scripting language designed specifically for use on the Web. It has features to aid you in programming the tasks needed to develop dynamic Web applications. PHP is in use on more than 20 million domains (according to the Netcraft survey at www.php.net/usage.php). Its popularity continues to grow, so it must be fulfilling its function pretty well.

NOTE

The PHP language syntax is similar to the syntax of C, so if you have experience with C, you'll be comfortable with PHP. PHP is actually simpler than C because it doesn't include some of the more difficult concepts of C — concepts not required to program Web sites.

In this chapter, we describe the basics of writing PHP scripts — the rules that apply to all PHP statements. Consider these rules similar to general grammar and punctuation rules. In the remaining chapters in this minibook, you find out about specific PHP statements and features and how to write PHP scripts to perform specific tasks.

Get PHP & MySQL® Web Development All-in-One Desk Reference for Dummies® 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.