Book description
With the surge of popularity of PHP 5, object-oriented programming is now an important consideration for PHP developers. This version-neutral book is a gentle introduction to object-oriented programming (OOP) that won't overburden you with complex theory. It teaches you the essential basics of OOP that you'll need to know before moving onto a more advanced level, and includes a series of prepackaged scripts that you can incorporate into your existing sites with the minimum of effort.
It shows how object-oriented programming can be used to create reusable and portable code by walking you through a series of simple projects. The projects feature the sorts of things developers run up against every day, and include a validator for filtering user input, a simple Date class that avoids the need to remember all the esoteric format codes in PHP, and an XML generator.
Teaches the fundamentals of OOP
Simple projects show how OOP concepts work in the real world
Prepackaged scripts can easily be added to your own projects
Table of contents
- Copyright
- ABOUT THE AUTHOR
- ABOUT THE TECHNICAL REVIEWER
- ACKNOWLEDGMENTS
- INTRODUCTION
- 1. WHY OBJECT-ORIENTED PHP?
-
2. WRITING PHP CLASSES
- 2.1. Formatting code for readability
- 2.2. Creating classes and objects
- 2.3. Using inheritance to extend a class
- 2.4. Loading classes automatically
- 2.5. Exploring advanced OOP features
- 2.6. Using magic methods
- 2.7. Handling errors with exceptions
- 2.8. Using comments to generate code hints
- 2.9. Chapter review
-
3. TAKING THE PAIN OUT OF WORKING WITH DATES
- 3.1. Designing the class
- 3.2. Building the class
- 3.3. Creating read-only properties
- 3.4. Organizing and commenting the class file
- 3.5. Chapter review
-
4. USING PHP FILTERS TO VALIDATE USER INPUT
- 4.1. Validating input with the filter functions
- 4.2. Building the validation class
- 4.3. Using the validation class
- 4.4. Sticking to your design decisions
- 4.5. Chapter review
- 5. BUILDING A VERSATILE REMOTE FILE CONNECTOR
- 6. SIMPLEXML—COULDN'T BE SIMPLER
-
7. SUPERCHARGED LOOPING WITH SPL
-
7.1. Introducing iterators
- 7.1.1. Using an array with SPL iterators
- 7.1.2. Limiting the number of loops with the LimitIterator
- 7.1.3. Using SimpleXML with an iterator
- 7.1.4. Filtering a loop with a regular expression
- 7.1.5. Looping sequentially through more than one set of data
- 7.1.6. Looking ahead with the CachingIterator
- 7.1.7. Using anonymous iterators as shorthand
- 7.2. Examining files and directories
- 7.3. Extending iterators
- 7.4. Chapter review
-
7.1. Introducing iterators
- 8. GENERATING XML FROM A DATABASE
- 9. CASE STUDY: CREATING YOUR OWN RSS FEED
Product information
- Title: PHP Object-Oriented Solutions
- Author(s):
- Release date: August 2008
- Publisher(s): Apress
- ISBN: 9781430210115
You might also like
book
Object-Oriented PHP
Object-Oriented PHP shows developers how to take advantage of the new object-oriented features of PHP. Working …
book
PHP Master
PHP Master is tailor-made for the PHP developer who's serious about taking their server-side applications to …
video
PHP Web Services
Learn how to build web services with PHP and exchange data across applications. In this video …
book
PHP 7: Real World Application Development
Use new features of PHP 7 to solve practical, real-world problems faced by PHP developers like …