PHP Anthology, Volume 1, Chapter 1: PHP Basics | WebReference

PHP Anthology, Volume 1, Chapter 1: PHP Basics

PHP Anthology, Volume 1, Chapter 1: PHP Basics

Reproduced from Harry Fuecks' The PHP Anthology, Volume 1: Foundations by permission of SitePoint Pty. Ltd.. ISBN 0957921853, copyright 2003. All rights reserved.


Table of Contents

Who should read this book?
What’s covered in this book?
The Book’s Website
The Code Archive
Updates and Errata
The SitePoint Forums
The SitePoint Newsletters
Your Feedback
One of the great things about PHP is its vibrant and active community. Developers enjoy many online meeting points, including SitePoint Forums where developers get together to help each other out with problems they face on a daily basis, from the basics of how PHP works, to solving design problems like “How do I validate a form?” As a way to get help, these communities are excellent—they’re replete with all sorts of vital fragments you’ll need to make your projects successful. But putting all that knowledge together into a solution that applies to your particular situation can be a problem. Often, community members assume other posters have some degree of knowledge; frequently, you might spend a considerable amount of time pulling together snippets from various posts, threads, and users (each of whom has a different programming style) to gain a complete picture.
The PHP Anthology is, first and foremost, a compilation of the best solutions provided to common PHP questions that turn up at the SitePoint Forums on a regular basis, combined with the experiences and insights I’ve gained from my work with PHP on a daily basis over the last four years.

What makes this book a little different from others on PHP is that it steps away from a tutorial style, and instead focuses on the achievement of practical goals with a minimum of effort. To that extent, you should be able to use many of the solutions provided here in a more or less “plug and play” manner, rather than having to read this book from cover to cover.

That said, threaded throughout these discussions is a “hidden agenda.” As well as solutions, this book aims to introduce you to techniques that can save you effort, and help you reduce the time it takes to complete and later maintain your Web-based PHP applications.

Although it was originally conceived as a procedural programming language, in recent years PHP has proven increasingly successful as a language for the development of object oriented solutions. This was further compounded by the public opening in January 2003 of the PHP Application and Extension Repository (PEAR), which provides a growing collection of reusable and well maintained solutions for architectural problems (such as Web form generation and validation) regularly encountered by PHP developers around the world.

The object oriented paradigm seems to scare many PHP developers, and is often regarded as “off limits” to all but the PHP gurus. What this book will show you is that you do not need a computer science degree to take advantage of the wealth of class libraries available in PHP today. Wherever possible in the development of the solutions provided in this book, I’ve made use of freely available libraries that I’ve personally found handy, and which have saved me many hours of development. Employing a class developed by someone else is often as easy as using any of the built-in functions PHP provides.

The emphasis this book places on taking advantage of reusable components to build your PHP Web applications reflects another step away from the focus of many current PHP-related books. Although you won’t find extensive discussions of object oriented application design, reading The PHP Anthology, Volume I: Foundations and Volume II: Applications from cover to cover will, through a process of osmosis, help you take your PHP coding skills to the next level, setting you well on your way to constructing applications that can stand the test of time.

The PHP Anthology, Volume I: Foundations, will equip you with the essentials with which you need to be confident when working the PHP engine, including a fast-paced primer on object oriented programming with PHP (see Chapter 2, Object Oriented PHP ). With that preparation out of the way, the book looks at solutions that could be applied to almost all PHP-based Web applications, the essentials of which you may already have knowledge of, but have yet to fully grasp.

If you have already gotten your feet wet with PHP, perhaps having read Kevin Yank’s Build Your Own Database Driven Website Using PHP & MySQL (SitePoint, ISBN 0-9579218-1-0) and completed your first project or two with PHP, then this is the book for you.

Readers with a greater amount of PHP experience may like to skip ahead to The PHP Anthology, Volume II: Applications to learn how to put some of PHP’s more advanced features to use, and refer back to Volume I: Foundations when they need an explanation of a more basic concept.

Created: March 27, 2003
Revised: January 2, 2004