Now installed on more than 20 million Internet domains around the world, PHP is an undisputed leader in web programming languages. Database connectivity, powerful extensions, and rich object-orientation are all reasons for its popularity, but nearly everyone would agree that, above all, PHP is one of the easiest languages to learn and use for developing dynamic web applications. The ease of development and simplicity of PHP, combined with a large community and expansive repository of open source PHP libraries, make it a favorite of web designers and developers worldwide.
PHP in a Nutshell is a complete reference to the core of the language as well as the most popular PHP extensions. This book doesn't try to compete with or replace the widely available online documentation. Instead, it is designed to provide depth and breadth that can't be found elsewhere. PHP in a Nutshell provides the maximum information density on PHP, without all the fluff and extras that get in the way. The topic grouping, tips, and examples in this book complement the online guide and make this an essential reference for every PHP programmer. This book focuses on the functions commonly used by a majority of developers, so you can look up the information you need quickly. Topics include:
Working with files
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.
Chapter 1 Introduction to PHP
Advantages of PHP
Chapter 2 Installing PHP
Installing on Windows
Installing on Unix
Testing Your Configuration
Chapter 3 The PHP Interpreter
Running PHP Scripts
Abnormal Script Termination
Chapter 4 The PHP Language
The Basics of PHP
Brief Introduction to Variable Types
Opening and Closing Code Islands
Special Loop Keywords
Loops Within Loops
Including Other Files
Chapter 5 Variables and Constants
Types of Data
True or False
Automatic Type Conversion
Checking Whether a Variable Is Set: isset()
Using $_ENV and $_SERVER
Chapter 6 Operators
Incrementing and Decrementing Operators
Some Operator Examples
The Ternary Operator
The Execution Operator
Operator Precedence and Associativity
Chapter 7 Function Reference
Handling Non-English Characters
Chapter 8 Object-Oriented PHP
The 'this' Variable
Objects Within Objects
Access Control Modifiers
Object Type Information
Class Type Hints
Constructors and Destructors
Comparing Objects with == and ===
Static Class Methods and Properties
Helpful Utility Functions
Dereferencing Object Return Values
Chapter 9 HTML Forms
What Does It Mean to Be Dynamic?
Designing a Form
Splitting Forms Across Pages
Chapter 10 Cookies and Sessions
Cookies Versus Sessions
Storing Complex Data Types
Chapter 11 Output Buffering
Why Use Output Buffering?
Flushing Stacked Buffers
Other OB Functions
Chapter 12 Security
Chapter 13 Files
Creating and Changing Files
Moving, Copying, and Deleting Files
Other File Functions
Checking Whether a File Exists
Retrieving File Time Information
Dissecting Filename Information
Handling File Uploads
Locking Files with flock()
Reading File Permissions and Status
Changing File Permissions and Ownership
Working with Links
Working with Directories
Parsing a Configuration File
Chapter 14 Databases
Using MySQL with PHP
Chapter 15 Regular Expressions
Basic Regexps with preg_match() and preg_match_all()
Regexp Character Classes
Regexp Special Characters
Words and Whitespace Regexps
Storing Matched Strings
Regular Expression Replacements
Regular Expression Syntax Examples
The Regular Expressions Coach
Chapter 16 Manipulating Images
Choosing a Format
Loading Existing Images
Color and Image Fills
Basic Image Copying
Scaling and Rotating
Points and Lines
Special Effects Using imagefilter()
Interlacing an Image
Getting an Image's MIME Type
Chapter 17 Creating PDFs
Adding More Pages and More Style
PDF Special Effects
Adding Document Data
Chapter 18 Creating Flash
A Simple Movie
Chapter 19 XML & XSLT
Transforming XML Using XSLT
Chapter 20 Network Programming
Chapter 21 Distributing Your Code
Cross-Platform Code 1: Loading Extensions
Cross-Platform Code 2: Using Extensions
Cross-Platform Code 3: Path and Line Separators
Cross-Platform Code 4: Coping with php.ini Differences
Cross-Platform Code 5: Checking the PHP Version with phpversion() and version_compare()
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.
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.
The cowardly (anonymous) review stating that it had all these errors must never have any bugs in his code.
However, the title should tell you, 'Nutshell'.
Often books are too little (too cute and too babyish) or too much (throwing you in at the deep end of the pool).
I have 'PHP Advanced Programming' by Schlossnagel and love it, but I am so pleased that I read this book so that I feel I have had a thorough and robust introduction without being clobbered by, well, all of the stuff one buys a book titled 'PHP Advanced Programming' for.
The thing I learned from this book, that I have never heard discussed before or since, is the subtle difference between 'OR' and '||' and 'AND' and '&&' -- he didn't treat me like a dummy nor did he wallow in geeky minutia, which allowed him to elegantly explain a very simple and key difference that is otherwise overlooked.
Bottom Line Yes, I would recommend this to a friend
The information within the book is good, but there are errors throughout the book. Errors in both the titles and in the definitions. If you are still learning PHP, be prepared to double check quite a few items in this book.
useful for all levels, but some experience would help
Comments about oreilly PHP in a Nutshell:
I'm fairly new to PHP, having implemented a couple of basic features in one of my websites. That said, this book is an invaluable aid, complementing the online PHP manual as a useful, concise reference guide. It not only covers the language core, but also looks at PHP extensions. Covers how to install PHP5, object-oriented PHP, file and string manipulation, HTML forms and other topics such as XML and multimedia.
As with all O'Reilly books, this one is liberally strewn with excellent examples and clear diagrams, and is well written for its target audience. It does presuppose some knowledge of basic programming concepts such as variables and loops, but would still appeal to the beginner as an addition to the online user guide.
I have 8+ years of programming experience, and I am very interested in expanding my skillset. PHP is one of the skills I would like to acquire. With that in mind, I think that this book is aimed towards experienced PHP developers; if you are just starting out with PHP, this book makes an indespensible companion to a tutorial such as "Programming PHP" by Rasmus Lerdorf and Kevin Tatroe , but "PHP In a Nutshell" is not a tutorial in its own right.
I like the examples throughout the book on how each function is used, and I found it well organized by sections. This book has also helped me think outside the box on redesigning an application currently written in VB.
At the beginning the author proveds a website for downloading and installing Apache, PHP and MySQL for Windows. I had a hard time with the configuration on Windows XP as suggested by the book, and found everything I needed in one simple package (Apache, PHP and MySQL)at:
I highly recommend this book for experienced PHP developers, and as a companion to a tutorial for beginners.