Page 31 - Beginning PHP 5.3
P. 31
Introduction
Chapter 2 walks you through installing a copy of the PHP engine on Ubuntu Linux, Windows, and Mac
OS X; looks at other ways you can install or use PHP; and shows you how to write a simple PHP script.
Chapter 3 looks at some basic PHP language concepts. You look at variables, data types, operators,
expressions, and constants.
Chapter 4 shows you how to change the flow of your scripts by creating decisions and loops. You
explore the if , else , and switch statements; the ternary operator; and the do , while , for , break , and
continue statements. You also learn how to nest loops, and how to mix decisions and looping with
blocks of HTML.
Chapter 5 explores PHP ’ s handling of strings, or sequences of characters. You learn how to create strings;
how to retrieve characters from a string; and how to manipulate strings with functions such as
strlen() , substr() , strstr() , strpos() , str_replace() , and printf() , to name but a few.
Chapter 6 covers arrays — variables that can hold multiple values. You learn the difference between
indexed and associative arrays, and find out how to create arrays and access their individual elements.
The rest of the chapter focuses on array manipulation, including functions such as print_r() , array_
slice() , count() , sort() , array_merge() , and list() . You also learn how to create foreach loops,
as well as how to work with multidimensional arrays.
Chapter 7 looks at the concept of functions — blocks of code that you can use again and again. You look
at how to call built - in functions, and how to work with variable functions. You also study how to create
your own functions, including defining parameters, returning values, understanding scope, and using
anonymous functions. Other function - related topics such as references and recursion are also explored.
Chapter 8 delves into the world of object - oriented programming. You look at the advantages of an
object - oriented approach, and learn how to build classes, properties, and methods, and how to create
and use objects. You also explore more advanced topics such as overloading, inheritance, interfaces,
constructors and destructors, autoloading, and namespaces.
Chapter 9 shows you how to use PHP to create interactive Web forms. You learn how to create HTML
forms, how to capture form data in PHP, and how to use PHP to generate dynamic forms. You also
explore file upload forms and page redirection.
Chapter 10 looks at how to preserve an application ’ s state between page views. You explore three
different strategies: query strings, cookies, and PHP sessions. The chapter includes an example user
login system.
Chapter 11 takes a look at PHP ’ s file and directory handling functions. You learn how to open and close
files; how to find out more information about a file; how to read from and write to files; how to work
with file permissions; how to copy, rename, and delete files; and how to manipulate directories. The
chapter includes a simple text editor as an example.
Chapters 12 – 14 explore databases in general and MySQL in particular, and show how to work with
MySQL databases using PHP. You learn some database and SQL theory; look at how to connect to
MySQL from PHP; and study how to retrieve, insert, update, and delete data in a MySQL database.
xxix
9/21/09 9:21:10 AM
flast.indd xxix
flast.indd xxix 9/21/09 9:21:10 AM