Buy 2+, save 55% on books & eBooks through December 1. Use code BOOKSGIVING. Learn more.
A short, concise, fast-paced introduction to PHP 5--for professionals transitioning to the world's most popular web programming language.
° From best-selling author Steve Holzner whose books have sold over 2 million copies worldwide.
° PHP is HUGE: According to Netcraft's August 2004 survey, over 16 million domains run PHP.
° A brisk introduction to PHP basics quickly gives way to such advanced topics as object-oriented programming, error handling, and database development with PHP...for both Linux and Windows systems.
The fastest route to true PHP mastery!
So...you've been asked to pitch in on a PHP project...starting now. Or maybe one's on the horizon. Or maybe you need to get real PHP skills onto your résumé. You've done web stuff. Maybe used other scripting languages. Now you want to get productive with PHP, fast.
Welcome. We wrote this book for you. We'll leverage what you already know, so you'll go further, faster than you ever expected.
You'll get the real nuts and bolts, not theory or hooey. You'll learn through dozens of focused examples: tested for reliability, crafted for clarity, easy to adapt for your own projects.
Need specific solutions? This book's modular, high-efficiency format delivers theminstantly. Award-winning author Steven Holzner draws on his unparalleled experience teaching programming: No other PHP guide covers this much, this well, this quickly. Dig in, get started, get resultstoday!
All you need to succeed with PHP in Linux or Windows
Master core concepts: operators, flow control, strings, arrays, functions, and more
Learn essential web techniques: cookies, session management, automated email, FTP, and more
Use PHP 5's object model and object-oriented techniques
Efficiently handle text boxes, buttons, and other HTML controls
Create web forms, validate user input, and check browsers
Work with MySQL and other databases
Includes concise PHP 5 language and functional references!
All the book's programming examples are available for download on the companion web site.
Spring Into is a new series of fast-paced tutorials from Addison-Wesley. Each book in the series is designed to bring you up-to-speed quickly. Complex topics and technologies are reduced to their core components, and each component is treated with remarkable efficiency in one- or two-page spreads. Just the information you need to begin working...now! And because the books are example-rich and easy to navigate, you'll find that they make great on-the-job references after you've mastered the basics.
© Copyright Pearson Education. All rights reserved.
About the Author.
About the Series Editor.
1. Essential PHP.
Setting Up Your Development Environment.
Creating Your First PHP Script.
Running Your First PHP Script.
What If It Doesn’t Work?
Mixing In Some HTML.
How About Printing Out Some Text?
More Printing Power.
Printing “Here” Documents.
Running PHP on the Command Line.
Commenting Your Scripts.
Getting a Handle on Data: Variables.
Assigning Values to Variables.
Interpolating Variables in Strings.
Creating Variable Variables.
Handling Data Types.
2. Gaining Control with Operators and Flow Control.
The Math Operators.
The Math Functions.
The Assignment Operators.
Incrementing and Decrementing.
The Execution Operator.
Using if Statements.
The Comparison Operators.
Using else Statements.
Using elseif Statements.
The Ternary Operator.
Using switch Statements.
Working with for Loops.
Working with while Loops.
Working with do...while Loops.
Working with foreach Loops.
Breaking Out of Loops.
Skipping Interactions with continue.
Some Alternative Syntax.
3. Handling Strings and Arrays.
Listing of String Functions.
Using the String Functions.
Converting to and from Strings.
Removing Array Elements.
Looping Over Arrays.
Listing of the Array Functions.
Navigating through Arrays.
Imploding and Exploding Arrays.
Extracting Variables from Arrays.
Merging and Splitting Arrays.
Manipulating the Data in Arrays.
Creating Multidimensional Arrays.
Looping Over Multidimensional Arrays.
Using the Array Operators.
4. Breaking It Up: Functions.
Creating a Function.
Passing Data to Functions.
Passing Arrays to Functions.
Setting Up Default Argument Values.
Passing Arguments by Reference.
Creating Variable-Length Argument Lists.
Returning Values from Functions.
Returning Arrays from Functions.
Returning Lists from Functions.
Returning References from Functions.
Using Variable Scope.
Getting Global Access.
Using Static Variables.
Creating Variable Functions.
Creating Conditional Functions.
Creating Functions within Functions.
Using Include Files.
Handling Errors Returned by Functions.
5. Handling HTML Controls in Web Pages.
Handling User Data with Web Forms.
Creating Text Fields.
Retrieving Data from Text Fields.
Creating Text Areas.
Creating Radio Buttons.
Creating Hidden Controls.
Creating Password Controls.
Creating Image Maps.
Reading Uploaded Files.
Creating Buttons: Take 1.
Creating Buttons: Take 2.
Creating Buttons: Take 3.
6. Creating Web Forms and Validating User Input.
Displaying All a Form’s Data At Once.
Useful Server Variables.
Useful HTTP Headers.
Determining Browser Type with HTTP Headers.
Redirecting Users with HTTP Headers.
Receiving Form Data in Custom Arrays.
Web Applications Using a Single PHP Page.
Validating User Data.
Validating Data: Requiring Data Entry.
Validating Data: Checking for Numbers.
Validating Data: Checking for Strings.
Removing HTML Tags.
Encoding HTML Tags.
Using HTTP Authentication.
7. Object Oriented Programming and File Handling.
Working with Classes and Objects.
Creating a Class.
Creating an Object.
Restricting Access to Properties and Methods.
Initializing Objects with Constructors.
Basing One Class on Another: Inheritance.
Using Protected Inheritance.
Accessing Base Class Methods.
Opening a File: fopen.
Reading Lines of Text: fgets.
Reading Characters: fgetc.
Binary Reading: fread.
Reading a Whole File: file_get_contents.
Parsing a File: fscanf.
Writing to a File: fwrite.
Appending to a File: fwrite.
Writing the File at Once: file_put_contents.
8. Working with Databases.
What Are Databases?
Some Basic SQL.
Setting Up Database Support in PHP.
Creating a Database Using MySQL.
Adding Data to the Database.
Accessing a MySQL Database.
Displaying a Data Table.
Updating Your Data.
Inserting New Data.
Creating a New Table.
Creating a Database.
Getting the PEAR DB Module.
Displaying a Table with DB.
Inserting New Data with DB.
Updating Data with DB.
9. Cookies, Sessions, FTP, Email, and More.
Setting a Cookie’s Expiration Time.
FTP: Getting a Directory Listing.
FTP: Downloading a File.
FTP: Uploading a File.
Sending Email with Headers.
Sending Email with Attachments.
Working with Sessions.
Storing Session Data.
Creating a Hit Counter.
Using Sessions Without Cookies.
Removing Data in Sessions.
Appendix A: PHP Language Elements.
Appendix B: PHP Function Reference.
Download the Index
file related to this title.