PHP Cookbook

by David Sklar and Adam Trachtenberg

Published 31 October 2002
PHP is a simple yet powerful open source scripting language that has become a big player in Web development. Over a million Web sites, from large corporate sites to small personal sites, are using PHP to serve dynamic Web content. PHP's broad feature set, approachable syntax, and support for different operating systems and Web servers make it an ideal language for rapid Web development. This is a collection of problems, solutions, and practical examples for PHP programmers. The book contains a collection of best practices for everyday PHP programming dilemmas. For every problem addressed in the book, there's a worked-out solution or "recipe" - short, focused pieces of code that you can insert directly into your applications. Also included are explanations of how and why the code works, so you can learn to adapt the problem-solving techniques to similar situations. The recipes in the cookbook range from simple tasks, such as sending a data base query and fetching URLs, to entire programs that demonstrate complex tasks, such as printing HTML tables and generating bar charts.
This book contains over 250 recipes on the following topics: working with basic data types, including strings, numbers, dates and times, and arrays; PHP building blocks, such as variables, functions, classes, and objects; Web programming, including forms, database access, and XML; useful features like regular expressions, encryption and security, graphics, internationalization and localization, and Internet services; working with files and directories; command-line PHP and PHP-GTK; and PEAR, the PHP Extension and Application Repository.