PHP 5 in Practice - Elliott White, Jonathan D. Eisenhamer

PHP 5 in Practice

Buch | Softcover
456 Seiten
2006
Sams Publishing (Verlag)
978-0-672-32888-6 (ISBN)
36,30 inkl. MwSt
  • Titel ist leider vergriffen;
    keine Neuauflage
  • Artikel merken
PHP has become one of the most popular languages for powering web content worldwide. This title serves as a compendium of practices and solutions. It is intended for the novice and the expert in PHP. It offers solutions that cover a large range of topics, including database access, dynamic web page creation, and so-called Web 2.0 technologies.
With the release of PHP 5 web developers need a guide to developing with PHP 5 to both learn its complex new features and more fully implement the long-standing features on which PHP's success is built. PHP 5 in Practice is a reference guide that provides developers with easy-to-use and easily extensible code to solve common PHP problems. It focuses on providing real code solutions to problems, allowing the reader to learn by seeing exactly what is happening behind the scenes to get your solution. Because a real-life situation will rarely match the book's example problems precisely, PHP 5 in Practice explains the solution well enough that you will understand it and can learn how to truly solve your own problem.

Elliott White III has been a professional programmer since 1995. He has given various presentations at international PHP and Web conferences on topics such as PHP, CSS, and XHTML, as well as helping Brainbench develop some of their programming certifications. He currently works for Digg.com as a senior PHP programmer. Jonathan Eisenhamer has served as systems administrator and software developer for the Astronomy department at UCLA. From there, he moved on to the Space Telescope Science Institute (STScI), where he began his work in PHP, developing websites to disseminate the scientific results from the Hubble Space Telescope to the general public. He currently is the supervisor of the Web and Print group at STScI.

           Introduction  

Part I   PHP Internals

1   Strings  



1.1 Matching Patterns (Regular Expressions) 

1.2 Cleaning Up Whitespace 

1.3 Expanding and Compressing Tabs  

1.4 Converting Text Between Macintosh, UNIX, and PC Format  

1.5 Parsing CSV (Comma-Separated Values)  

1.6 Truncating Text to Fit Within a Specific Space  

1.7 Padding Arrays of Data to Display as Columns  

1.8 Checking the Spelling of a Word  

1.9 Matching Similar Strings  

1.10 Performing Proper Capitalization on Titles  

1.11 Generating Unique Identifiers  

1.12 Counting the Number of Times Certain Words Appear

2   Numbers  

2.1 Retrieving a Number from a String  

2.2 Printing Proper Plural Text  

2.3 Converting Numbers into Roman Numerals  

2.4 Calculating Interest  

2.5 Simulating Dice  

2.6 Latitude/Longitude Calculations  

2.7 Metric/English Conversion  

2.8 Temperature Conversion  

2.9 Statistics Package Creation  

3   Time and Date  

3.1 Calculating the Difference Between Two Dates  

3.2 Determining Last Day of a Given Month  

3.3 Leap Year Calculation  

3.4 Handling Time Zones  

3.5 Handling Time Stamps Within Databases or in Files  

3.6 Determining Number of Business Days  

3.7 Generating a Calendar for a Given Month  

4   Variables  

4.1 Determining Whether a Variable Is Equal to Another  

4.2 Accessing a Variable Outside a Function, from Within it (Global Variables)  

4.3 Keeping a Persistent Value Within a Function (Static Variables)  

4.4 Having One Variable Refer to Another (References)  

4.5 Using a Variable to Hold the Name of Another Variable  

4.6 Declaring a Constant Instead of a Variable  

4.7 Coalescing a List of Values to Determine the First Non-False Value  

5   Arrays  

5.1 Superglobal Arrays and Their Usage  

5.2 Stack Implementation  

5.3 Queue Implementation  

5.4 Sorting with User-Defined Comparisons  

5.5 Sorting with Alternative Algorithms  

5.6 Recursive Handling of Multidimensional Arrays  

5.7 Performing Set Operations on Arrays

5.8 Matrix Math Execution Using Arrays  

6   Functions  

6.1 Setting Optional Parameters  

6.2 Creating Recursive Functions  

6.3 Calling Functions Using a Function Name Stored in a Variable  

6.4 Dynamically Creating a Function (Lambda-Style)  

6.5 Using an Array of Functions for Processing  

6.6 Passing or Returning a Value by Reference  

6.7 Using an Arbitrary Number of Parameters  

6.8 Requiring a Parameter to Be a Certain Type  

7   Classes and Objects  

7.1 Automatically Loading Class Source Files  

7.2 Protecting Object Data (public/private/protected)  

7.3 Automatically Running Code On Creation or Destruction of an Object  

7.4 Accessing a Class’s Members Without Instantiation  

7.5 Extending a Class Definition  

7.6 Creating an Abstract Class  

7.7 Using Object Interfaces  

7.8 Dynamic and Overloaded Variable Names  

7.9 Overloading Methods  

7.10 Linked List Implementation  

7.11 Binary Tree Implementation  

8   Files and Directories  

8.1 Generating a Full Directory Listing  

8.2 Natural Display of File Sizes  

8.3 Renaming All Files Within a Directory  

8.4 Search for Filenames Within a Directory Tree  

8.5 Handling Relative and Absolute File Paths  

8.6 Reading a File Via HTTP or FTP  

8.7 Watching the Contents of a File As It Grows (Simulating UNIX tail -f)  

8.8 Generating a Difference Report Between Two Files  

8.9 Locking a File for Exclusive Use  

8.10 Caching Remote Files Locally  

8.11 Compressing and Uncompressing Files  

8.12 Automatically Including Certain Files from the Parent Tree  

Part II   Application

9   Web Page Creation/XHTML/CSS  

9.1 Creating a Multilayer Drop-Down Menu  

9.2 Highlighting What Section of a Website the User Is In  

9.3 Displaying Dynamic Progress Bars  

9.4 Simulating Graphical Charts with XHTML/CSS  

9.5 Pagination of Results on a Web Page  

9.6 Caching Web Page Output for Server Optimization  

9.7 Localizing a Web Page for Different Languages  

9.8 Using Ajax with PHP to Create an Interactive Web Page  

10   Web Form Handling  

10.1 Easily Obtaining Form Data  

10.2 Obtaining Multidimensional Arrays of Form Data  

10.3 Using GET and POST Form Data Together  

10.4 Accepting Uploaded Files  

10.5 Generating Select Statements  

10.6 Requiring Certain Fields to Be Filled Out  

10.7 Manipulating Text for Display on Bulletin Boards (BBCode)  

10.8 Accepting and Displaying User Data Giving Warnings for Links  

10.9 Preventing Multiple Form Submissions  

11   Data Validation and Standardization  

11.1 Phone Numbers  

11.2 ZIP Codes  

11.3 Social Security Numbers (SSNs)  

11.4 Numbers  

11.5 Credit Card Numbers  

11.6 Dates  

11.7 Email Accounts  

11.8 URLs  

12   Sessions and User Tracking  

12.1 Using Cookies to Remember Data  

12.2 Saving User Data with Sessions  

12.3 Customizing Display Settings for a User  

12.4 Creating a Library for Tracking a User Through Your Website  

12.5 Implementing a Simple Shopping Cart  

12.6 Passing Session Data Between Two Servers  

12.7 Parsing Specific Browser Information from Log Files  

13   Web Services and Other Protocols  

13.1 Submitting a POST HTTP Request with cURL  

13.2 Communicating with an LDAP Server  

13.3 Using Web Services Via SOAP  

13.4 Connecting to an FTP Server  

13.5 Creating a PHP-Based FTP Client  

13.6 Using Sockets to Connect to an Internet Server  

13.7 Creating Your Own Basic Web Server  

14   Relational Databases  

14.1 Communicating with MySQL  

14.2 Communicating with Oracle  

14.3 Communicating with PostgreSQL  

14.4 Communicating with Sybase  

14.5 Communicating with Microsoft SQL Server  

14.6 Communicating with SQLite  

14.7 Communicating with Databases Through ODBC  

14.8 Using an Abstraction Layer to Communicate with a Database (PDO)  

14.9 Implementing an SQLite Based Blog  

15   Other Data Storage Methods  

15.1 Creating and Reading CSV files  

15.2 Using Custom Text Files for Storage  

15.3 Accessing and Updating DBM-Style Databases  

15.4 Storing Data Via Serialize and Unserialize  

15.5 Automatically Creating and Updating PHP Include Files  

16   Email  

16.1 Sending Email (Text/HTML/Dual Format/Inline Images/Attachments)  

16.2 Determining Whether an Email Account Exists  

16.3 Creating a Mass Email Mailer  

16.4 Implementing Basic Mailing List Software  

16.5 Protecting Email Addresses from Spam Collectors  

16.6 Creating a Watchdog Process to Send Email If a Web Page Changes  

17   XML  

17.1 Parsing an XML File to Retrieve Data  

17.2 Performing Searches Through XML with XPath  

17.3 Validating an XML Document  

17.4 Transforming XML into XHTML with XSLT  

17.5 Creating an RSS File  

17.6 Creating an RSS Display Script for Websites  

18   Images  

18.1 Generating Composite Images with Text  

18.2 Drawing Tips and Tricks  

18.3 Using Transparent Backgrounds in Images  

18.4 Creating a Graph/Chart Library  

18.5 Automatically Creating a Photo Gallery from Digital Camera Files (Exif Data)  

19   Error Reporting and Debugging  

19.1 Defining a Custom Error Handler  

19.2 Using Exceptions to Handle Errors  

19.3 Timing the Execution of Your Script  

19.4 Using Shutdown Functions to Gracefully Handle Script Failures  

19.5 Generating Detailed Backtracing for Error Reporting  

20   User Authentication and Encryption  

20.1 Generating Random Passwords  

20.2 Using Encryption to Protect Data  

20.3 Simple CAPTCHA for Real User Detection  

20.4 Authenticating Users  

Part III   Appendixes

A   Migrating to PHP 5  

B   SPL  

C   Common PHP Error Messages  

Index  

 

Erscheint lt. Verlag 20.7.2006
Verlagsort Indianapolis
Sprache englisch
Maße 227 x 179 mm
Gewicht 694 g
Themenwelt Informatik Office Programme Outlook
Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Web / Internet Web Design / Usability
ISBN-10 0-672-32888-7 / 0672328887
ISBN-13 978-0-672-32888-6 / 9780672328886
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich