Buying Options
PHP in a Nutshell
Print $29.95
Add to Cart
Print+Ebook $32.95
Add to Cart
Ebook $23.99
Add to Cart
Safari Books Online
Add to Cart
What is this?
Print £22.99
Add to Cart
What is this?
Description
PHP in a Nutshell is a complete reference to the core of the language as well as the most popular PHP extensions. The topic grouping, tips, and examples in this book make it an essential reference for every PHP programmer. It covers the functions commonly used by a majority of developers, so you can look up the information you need quickly. Whether you're just getting started or have years of experience in PHP development, PHP in a Nutshell is a valuable addition to your desk library.
Full Description
Table of Contents
  1. Chapter 1 Introduction to PHP

    1. PHP History

    2. Advantages of PHP

    3. Getting Help

    4. Getting Certified

    5. PHP Resources

  2. Chapter 2 Installing PHP

    1. Installing on Windows

    2. Installing on Unix

    3. Testing Your Configuration

    4. System Configuration

  3. Chapter 3 The PHP Interpreter

    1. Running PHP Scripts

    2. Extending PHP

    3. PEAR

    4. Abnormal Script Termination

  4. Chapter 4 The PHP Language

    1. The Basics of PHP

    2. Variables

    3. Whitespace

    4. Heredoc

    5. Brief Introduction to Variable Types

    6. Code Blocks

    7. Opening and Closing Code Islands

    8. Comments

    9. Conditional Statements

    10. Case Switching

    11. Loops

    12. Infinite Loops

    13. Special Loop Keywords

    14. Loops Within Loops

    15. Mixed-Mode Processing

    16. Including Other Files

    17. Functions

  5. Chapter 5 Variables and Constants

    1. Types of Data

    2. True or False

    3. Strings

    4. Integers

    5. Floats

    6. Automatic Type Conversion

    7. Checking Whether a Variable Is Set: isset()

    8. Variable Scope

    9. Variable Variables

    10. Superglobals

    11. Using $_ENV and $_SERVER

    12. References

    13. Constants

    14. Arrays

  6. Chapter 6 Operators

    1. Arithmetic Operators

    2. Assignment Operators

    3. String Operators

    4. Bitwise Operators

    5. Comparison Operators

    6. Incrementing and Decrementing Operators

    7. Logical Operators

    8. Some Operator Examples

    9. The Ternary Operator

    10. The Execution Operator

    11. Operator Precedence and Associativity

  7. Chapter 7 Function Reference

    1. Undocumented Functions

    2. Handling Non-English Characters

  8. Chapter 8 Object-Oriented PHP

    1. Conceptual Overview

    2. Classes

    3. Objects

    4. Properties

    5. The 'this' Variable

    6. Objects Within Objects

    7. Access Control Modifiers

    8. Object Type Information

    9. Class Type Hints

    10. Constructors and Destructors

    11. Copying Objects

    12. Comparing Objects with == and ===

    13. Saving Objects

    14. Magic Methods

    15. Static Class Methods and Properties

    16. Helpful Utility Functions

    17. Interfaces

    18. Dereferencing Object Return Values

  9. Chapter 9 HTML Forms

    1. What Does It Mean to Be Dynamic?

    2. Designing a Form

    3. Handling Data

    4. Splitting Forms Across Pages

    5. Validating Input

    6. Form Design

    7. Summary

  10. Chapter 10 Cookies and Sessions

    1. Cookies Versus Sessions

    2. Using Cookies

    3. Using Sessions

    4. Storing Complex Data Types

  11. Chapter 11 Output Buffering

    1. Why Use Output Buffering?

    2. Getting Started

    3. Reusing Buffers

    4. Stacking Buffers

    5. Flushing Stacked Buffers

    6. Reading Buffers

    7. Other OB Functions

    8. Flushing Output

    9. Compressing Output

    10. URL Rewriting

  12. Chapter 12 Security

    1. Security Tips

    2. Encryption

  13. Chapter 13 Files

    1. Reading Files

    2. Creating and Changing Files

    3. Moving, Copying, and Deleting Files

    4. Other File Functions

    5. Checking Whether a File Exists

    6. Retrieving File Time Information

    7. Dissecting Filename Information

    8. Handling File Uploads

    9. Locking Files with flock()

    10. Reading File Permissions and Status

    11. Changing File Permissions and Ownership

    12. Working with Links

    13. Working with Directories

    14. Remote Files

    15. File Checksums

    16. Parsing a Configuration File

  14. Chapter 14 Databases

    1. Using MySQL with PHP

    2. PEAR::DB

    3. SQLite

    4. Persistent Connections

    5. MySQL Improved

  15. Chapter 15 Regular Expressions

    1. Basic Regexps with preg_match() and preg_match_all()

    2. Regexp Character Classes

    3. Regexp Special Characters

    4. Words and Whitespace Regexps

    5. Storing Matched Strings

    6. Regular Expression Replacements

    7. Regular Expression Syntax Examples

    8. The Regular Expressions Coach

  16. Chapter 16 Manipulating Images

    1. Getting Started

    2. Choosing a Format

    3. Getting Arty

    4. More Shapes

    5. Complex Shapes

    6. Outputting Text

    7. Loading Existing Images

    8. Color and Image Fills

    9. Adding Transparency

    10. Using Brushes

    11. Basic Image Copying

    12. Scaling and Rotating

    13. Points and Lines

    14. Special Effects Using imagefilter()

    15. Interlacing an Image

    16. Getting an Image's MIME Type

  17. Chapter 17 Creating PDFs

    1. Getting Started

    2. Adding More Pages and More Style

    3. Adding Images

    4. PDF Special Effects

    5. Adding Document Data

  18. Chapter 18 Creating Flash

    1. A Simple Movie

    2. Flash Text

    3. Actions

    4. Animation

  19. Chapter 19 XML & XSLT

    1. SimpleXML

    2. Transforming XML Using XSLT

  20. Chapter 20 Network Programming

    1. Sockets

    2. HTTP

    3. Sending Mail

    4. Curl

  21. Chapter 21 Distributing Your Code

    1. Cross-Platform Code 1: Loading Extensions

    2. Cross-Platform Code 2: Using Extensions

    3. Cross-Platform Code 3: Path and Line Separators

    4. Cross-Platform Code 4: Coping with php.ini Differences

    5. Cross-Platform Code 5: Checking the PHP Version with phpversion() and version_compare()

  22. Chapter 22 Debugging

    1. The Most Basic Debugging Technique

    2. Making Assertions

    3. Triggering Your Own Errors

    4. Testing with php_check_syntax()

    5. Source Highlighting

    6. Handling MySQL Errors

    7. Exception Handling

    8. Backtracing Your Code

    9. Custom Error Handlers

    10. Custom Exception Handlers

    11. Using @ to Disable Errors

    12. phpinfo()

    13. Output Style

  23. Chapter 23 Performance

    1. Write Your Code Sensibly

    2. Use the Zend Optimizer

    3. Use a PHP Code Cache

    4. Compress Your Output

    5. Don't Use CGI

    6. Debug Your Code

    7. Use Persistent Connections

    8. Compile Right

  1. Colophon

View Full Table of Contents
Product Details
Title:
PHP in a Nutshell
By:
Paul Hudson
Publisher:
O'Reilly Media
Formats:
  • Print
  • Ebook
  • Safari Books Online
Print Release:
October 2005
Ebook Release:
June 2009
Pages:
384
Print ISBN:
978-0-596-10067-4
| ISBN 10:
0-596-10067-1
Ebook ISBN:
978-0-596-10559-4
| ISBN 10:
0-596-10559-2
Customer Reviews
About the Author
  1. Paul Hudson

    Paul Hudson, an avid PHP programmer, is Deputy Editor of the popular European Linux journal Linux Format, and author of the publication's PHP tutorial section. He is the author of Fedora 4 Unleashed and of the online book Practical PHP Programming available at http://www.hudzilla.org.

    View Paul Hudson's full profile page.

Colophon

Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects.

The animal on the cover of PHP in a Nutshell is a cuckoo (Cuculus canorus). Cuckoos epitomize minimal effort. The common cuckoo doesn't build a nest-instead, the female cuckoo finds another bird's nest that already contains eggs and lays an egg in it (a process she may repeat up to 25 times, leaving 1 egg per nest). The nest mother, who is usually of a different bird species, rarely notices the addition, and usually incubates the egg and then feeds the hatchling as if it were her own. Why don't nest mothers notice that the cuckoo's eggs are different from their own eggs? Recent research suggests that it's because the eggs look the same in the ultraviolet spectrum, which birds can see.

When they hatch, the baby cuckoos push all the other (non-cuckoo) eggs out of the nest. If the other eggs hatched first, the babies are pushed out too. The host parents often continue to feed the cuckoo even after it grows to be much larger than they are, and cuckoo chicks sometimes use their call to lure other birds to feed them as well. Interestingly, only Old World (European) cuckoos colonize other nests. The New World (American) cuckoos build their own (untidy) nests. Like many Americans, these cuckoos migrate to the tropics for winter.

Cuckoos have a long and glorious history in literature and the arts. The Bible mentions them, as do Pliny and Aristotle. Beethoven used the cuckoo's distinctive call in his Pastoral Symphony. And here's a bit of etymology: the word "cuckold" (a husband whose wife is cheating on him) comes from "cuckoo." Presumably, the practice of laying one's eggs in another's nest seemed an appropriate metaphor.

Adam Witwer was the production editor and Chris Downey was the copyeditor for PHP in a Nutshell. Carol Marti proofread the text. Sanders Kleinfeld and Claire Cloutier provided quality control. Johnna VanHoose Dinse wrote the index. Karen Montgomery designed the cover of this book, based on a series design by Edie Freedman, and produced the cover layout with Adobe InDesign CS using Adobe's ITC Garamond font. The cover image is a 19th-century engraving from the Dover Pictorial Archive.

David Futato designed the interior layout. This book was converted by Judy Hoer to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano, Jessamyn Read, and Lesley Borash using Macromedia FreeHand MX and Adobe Photoshop CS. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Nathan Torkington and Rachel Wheeler.

  • Book cover of PHP in a Nutshell