About the Author .............................................................................xi
About the Technical Reviewer ............................................................xiii
Acknowledgments ............................................................................xv
Introduction ....................................................................................xvii
Chapter 1: The First Program ............................................................1
Chapter 2: Variables and Data Types ..................................................27
Chapter 3: The Control Statements ....................................................53
Chapter 4: Arrays ............................................................................91
Chapter 5: Functions .......................................................................127
Chapter 6: Useful Tricks and Operations .............................................171
Chapter 7: Classes and Objects .........................................................199
Chapter 8: Inheritance .....................................................................243
Chapter 9: Advanced OOP Mechanisms ...............................................273
Chapter 10: Error Handling ...............................................................303
Chapter 11: Generators and Iterators .................................................335
Chapter 12: Using PHP .....................................................................361
Chapter 13: Afterword: What Was and What Will Be .............................405
Index .............................................................................................407
Learn to create web applications in PHP with minimal previous experience. This book is a practical guide to using PHP for web development.
Loaded with examples and step-by-step instructions, each chapter is dedicated to a specific area or function. You’ll first review the main principles of PHP and what is needed to program and develop in it. You’ll then study variables, data types, control statements, arrays, and functions, all critical for creating efficient PHP programs.
The book then moves on to object-oriented programming (OOP) and how to implement those principles in PHP, as well as inheritance, interfaces, testing, error handling, and exceptions. By the end of PHP by Example, you will have the knowledge and confidence to implement PHP for your web projects both large and small.
Understand PHP from the ground up
Create scripts and implement them in real-world projects
Work with a broad toolkit of ready-made exercises and solutions
Investigate the main constructions of the PHP