PHP Developer's Cookbook - Second Edition - Sterling Hughes - 2001.
PHP is an open source, server-side, HTML-embedded scripting language used to create dynamically generated Web pages. With an easy-to-use syntax and a large, extensible library of modules, PHP makes it fast and easy to create powerful data-driven Web sites for e-commerce, community portals, and other Web-based applications.
The PHP Developer's Cookbook is a task-based reference designed to give developers easy-to-follow solutions to common problems they might encounter. Each solution provides complete code listings along with an in-depth explanation of how and why a particular solution was used.
Copyright
Foreword
About the Authors
Acknowledgments
Tell Us What You Think!
Introduction
Purpose
How to Use This Book
Chapter Summary
DB.php and Its Use in This Book
The History of PHP
Enter PHP 4
Improved Performance
Improved Object-Oriented Support
Improved Array-Handling Support
Integrated Sessions Support
Java Integration
Output Buffering Support
Many New Extensions
PEAR
Part I: Language Constructs and Techniques
Chapter 1. Manipulating Strings
Section 1.0. Introduction
Section 1.1. Dissecting Strings
Section 1.2. Using the Ternary Operator
Section 1.3. Swapping Variables
Section 1.4. Converting ASII Codes into Characters
Section 1.5. Splitting a String by Characters
Section 1.6. Reversing Parts of a String
Section 1.7. Converting the Case of a String
Section 1.8. Removing Whitespace from a String
Section 1.9. Escaping Special Characters in a String
Section 1.10. Reading a Comma-Delimited Text File
Section 1.11. Parsing a URL
Section 1.12. Fuzzy Matching
Section 1.13. Creating a Unique Identifier
Section 1.14. Encrypting a String
Section 1.15. Converting Between Cyrillic Character Sets
Chapter 2. Working with Numbers, Dates, and Times
Section 2.0. Introduction
Section 2.1. Checking Whether a Variable Is a Valid Number
Section 2.2. Working on a Series of Numbers
Section 2.3. Working with Numbers That Are Not Float or Integer
Section 2.4. Rounding Arbitrary-Precision Numbers
Section 2.5. Converting Numbers Between Different Bases
Section 2.6. Finding the Log of a Number
Section 2.7. Finding the Binary Representation of a Number
Section 2.8. Converting Between Arabic and Roman Numerals
Section 2.9. Validating Credit Card Numbers
Section 2.10. Formatting Numbers
Section 2.11. Converting Between Radians and Degrees
Section 2.12. Calculating Cosines, Sines, and Tangents
Section 2.13. Generating Random Numbers
Section 2.14. Generating Unique Random Numbers
Section 2.15. Weighting Random Numbers
Section 2.16. Loading Today's Date into an Array
Section 2.17. Checking the Validity of a Date
Section 2.18. Determining Date Intervals
Section 2.19. Finding the Date and Time for Different Locales
Section 2.20. Formatting Timestamps
Section 2.21. Parsing Dates and Times from Strings
Section 2.22. Performing Benchmarks
Section 2.23. Halting Program Execution
Chapter 3. Using Arrays
Section 3.0. Introduction
Section 3.1. Declaring an Array
Section 3.2. Printing Out an Array
Section 3.3. Eliminating Duplicate Elements
Section 3.4. Enlarging or Shrinking an Array
Section 3.5. Merging Arrays
Section 3.6. Iteratively Processing Elements in an Array
Section 3.7. Accessing the Current Element in an Array
Section 3.8. Accessing Different Areas of an Array
Section 3.9. Searching an Array
Section 3.10. Searching for the Different Elements in Two Arrays
Section 3.11. Randomizing the Elements of an Array
Section 3.12. Determining the Union, Intersection, or Difference Between Two Arrays
Section 3.13. Sorting an Array
Section 3.14. Sorting Sensibly
Section 3.15. Reversing Order
Section 3.16. Perl-Based Array Manipulation Features
Chapter 4. PHP's Built-in Arrays and Constants
Section 4.1. Working with File Constants
Section 4.2. PHP's OS and Version Constants
Section 4.3. Setting Breakpoints by Using PHP's Error Constants
Section 4.4. Defining Your Own PHP Constants
Section 4.5. Working with PHP Globals
Section 4.6. Accessing Data Through PHP's Built-in Arrays
Chapter 5. Matching Data with Regular Expressions
Section 5.0. Introduction
Regular Expression Basics
Section 5.1. Assigning the Results of a Pattern Replacement
Section 5.2. Using Perl-Compatible Regular Expressions in PHP
Section 5.3. Incompatibilities Between the PCRE Library and Perl Regular Expressions
Section 5.4. Matching over Multiple Lines
Section 5.5. Finding a Specific Occurrence of a Match
Section 5.6. Working with Delimited Records
Section 5.7. Extracting Specific Lines
Section 5.8. Checking Characters
Section 5.9. Validating Web Data
Section 5.10. Validating an E-mail Address
Section 5.11. Checking the Syntax of a Regular Expression
Section 5.12. Checking for Duplicate Words
Section 5.13. Abbreviating Input
Chapter 6. Handling Files
Section 6.0. Introduction
Section 6.1. Checking Whether a File Exists
Section 6.2. Checking File Permissions
Section 6.3. Creating a Temporary File
Section 6.4. Storing a File into Your Program
Section 6.5. Opening a File
Section 6.6. Handling Binary Data Safely
Section 6.7. Flushing the Cache
Section 6.8. Locking Files
Section 6.9. Getting the Free Space Available on a Specified Drive
Section 6.10. Displaying a Textfile to the User
Section 6.11. Manipulating Standard I/O Streams
Section 6.12. Reading a File Line-by-Line
Section 6.13. Working with a File Word-by-Word
Section 6.14. Processing a File in Reverse
Section 6.15. Parsing a File with Pattern Separators
Section 6.16. Changing a Specific Record
Section 6.17. Accessing Fixed-Length Records
Section 6.18. Extracting a Single Line from a File
Section 6.19. Truncating a File
Section 6.20. Counting the Number of Lines in a File
Section 6.21. Extracting a Random Line from a File
Section 6.22. Randomizing Lines and Words
Section 6.23. Creating Configuration Files
Chapter 7. Working with Files in Directories
Section 7.0. Introduction
Section 7.1. Working with Timestamps
Section 7.2. Removing a File
Section 7.3. Copying or Moving a File
Section 7.4. Keeping Track of Filenames
Section 7.5. Parsing the Parts of a Filename
Section 7.6. Loading All Files in a Directory into an Array
Section 7.7. Searching a Filesystem
Section 7.8. Processing a Directory File-by-File
Section 7.9. Recursively Deleting a Directory
Section 7.10. Creating a Search Engine
Chapter 8. Functions
Section 8.0. Introduction
Section 8.1. Passing a Default Value to a Function
Section 8.2. Accessing Variables Outside a Function
Section 8.3. Returning Values from a Function
Section 8.4. Passing Arguments by Reference
Section 8.5. Retaining a Variable's Value Between Function Calls
Section 8.6. Returning More Than One Value from a Function
Section 8.7. Declaring Functions Dynamically
Section 8.8. Dynamically Creating Anonymous Functions
Section 8.9. Calling Functions Indirectly
Section 8.10. Fetching an Arbitrary Number of Parameters
Chapter 9. Classes
Section 9.0. Introduction
Section 9.1. Creating a Class
Section 9.2. Accessing Variables from Within a Class
Section 9.3. Inheritance
Section 9.4. Making Variables or Functions Public and Private
Section 9.5. Creating a Constructor
Section 9.6. Returning a Different Object from a Constructor
Section 9.7. Creating a Class Destructor
Section 9.8. Using Functions in a Class Without Initializing an Object
Section 9.9. Indirectly Accessing a Method of the Parent Class
Section 9.10. Returning an Error Object on Failure
Chapter 10. Maintaining Sessions with PHP
Section 10.0. Introduction
Section 10.1. Creating a Session Variable with PHP
Section 10.2. Saving Sessions Using a Database
Section 10.3. Setting the Session Name
Section 10.4. Setting and Getting Cookie Parameters
Section 10.5. Unregistering a Variable in a Session
Section 10.6. Deleting All the Session Variables
Section 10.7. Using Objects As Session Variables
Section 10.8. Encode That Data
Section 10.9. Creating a Shopping Cart Using Sessions and PHP
Section 10.10. Serialization
Section 10.11. WDDX Serialization
Section 10.12. WDDX Deserialization
Chapter 11. Interacting with Web Pages and Servers
Section 11.0. Introduction
Section 11.1. Fetching a Web Page
Section 11.2. Performing an SSL Transaction
Section 11.3. Performing an HTTP POST Request
Section 11.4. Performing an HTTP File Upload
Section 11.5. Sending Cookies with Your Request
Section 11.6. Excluding or Including the Header from a cURL Transfer
Section 11.7. Connecting Through a Proxy Server
Section 11.8. Getting Information Regarding a cURL Transfer
Section 11.9. Interacting with Frames
Section 11.10. Extracting All the URLs from a Web Page
Section 11.11. Finding Stale and Fresh Links
Section 11.12. Getting New Links from a Web Page
Section 11.13. Mirroring a Web Page
Section 11.14. Parsing and Formatting a Log File
Part II: Databases
Chapter 12. Creating a Database-Independent API with PHP
Section 12.0. Introduction
Section 12.1. The Glue
Section 12.2. The MySQL Module
Section 12.3. The mSQL Module
Section 12.4. The Oracle Module
Section 12.5. The MSSQL Module
Section 12.6. The ODBC Module
Section 12.7. The PostgreSQL Module
Section 12.8. The InterBase Module
Section 12.9. The Sybase Module
Part III: Going Outside PHP
Chapter 13. Interfacing with Other Programs and Languages
Section 13.0. Introduction
Section 13.1. Capturing the Output of Another Program
Section 13.2. Printing the Output of a Program
Section 13.3. Opening a Pipe to Another Program
Section 13.4. Working with Sockets
Section 13.5. Working with COM Objects
Section 13.6. Accessing Predefined Java Methods and Classes
Section 13.7. Accessing Your Own Custom Java Methods and Classes
Chapter 14. Communicating with Sockets
Section 14.0. Introduction
Section 14.1. A TCP Client
Section 14.2. A TCP Server
Section 14.3. Reading and Writing to Sockets
Section 14.4. A UDP Client
Section 14.5. A UDP Server
Section 14.6. UNIX Domain Sockets
Section 14.7. Handling Multiple IP Addresses
Section 14.8. Nonblocking Sockets
Section 14.9. Reading and Writing I/O Vectors
Section 14.10. Controlling Data Transfer Timeout
Section 14.11. Getting Socket Status
Chapter 15. Handling E-mail
Section 15.0. Introduction
Section 15.1. Opening an IMAP Mailbox
Section 15.2. Checking Whether an IMAP Stream Is Still Active
Section 15.3. Converting Messages to a Readable Format
Section 15.4. Sending E-mail
Section 15.5. Sending Attachments with PHP
Section 15.6. Sending Binary Attachments
Section 15.7. Sending HTML E-mail
Section 15.8. Getting the Size of a Message
Section 15.9. Parsing Mail Headers
Chapter 16. Working with SNMP Objects
Section 16.0. Introduction
Section 16.1. Setting an SNMP Object
Section 16.2. Getting an SNMP Object
Section 16.3. Fetching All SNMP Objects into an Array
Chapter 17. LDAP
Section 17.0. Introduction
Section 17.1. Adding an Entry to an LDAP Server
Section 17.2. Removing an Entry from an LDAP Server
Section 17.3. Executing a Query and Getting the Results
Section 17.4. Freeing an LDAP Result Set
Section 17.5. Performing a Tree Search
Section 17.6. Sorting Search Results
Part IV: Generating Other Languages
Chapter 18. Creating and Managing Images
Section 18.1. Creating an Image with GD
Section 18.2. Opening a Preexisting Image
Section 18.3. Getting the Size of an Image
Section 18.4. Adding Text to Images
Section 18.5. Getting the Color of a Certain Part of an Image
Section 18.6. Getting the Total Number of Colors in an Image
Section 18.7. Making a GIF/PNG Transparent
Section 18.8. Copy One Part of an Image to Another
Section 18.9. Drawing Rectangles
Section 18.10. Drawing Polygons
Section 18.11. Drawing an Arc
Section 18.12. Making an Image Interlaced
Section 18.13. Dynamic Buttons
Section 18.14. Using TrueType Fonts
Chapter 19. HTML
Section 19.0. Introduction
Section 19.1. Stripping HTML Tags
Section 19.2. Converting ASCII to HTML
Section 19.3. Generating <select> Lists
Section 19.4. Generating JavaScript Rollovers
Section 19.5. Creating HTML Templates
Chapter 20. XML
Section 20.0. Introduction
Section 20.1. Error Handling
Section 20.2. Parsing a Simple XML Document
Section 20.3. Parsing an XML Document into an Array
Section 20.4. Mapping XML Tags
Section 20.5. Setting Up an External Reference Entity Handler
Section 20.6. Searching XML
Section 20.7. Saving Memory
Section 20.8. Setting and Getting Options
Section 20.9. Parsing Using the DOM-XML Functions
Section 20.10. Building an XML Document
Section 20.11. Transforming XML with an XSL Template
Section 20.12. Filtering All Output Through an XSL File
Part V: The Zend API
Chapter 21. Zend API
Section 21.0. Introduction
Section 21.1. Getting Arguments
Section 21.2. Modifying Function Arguments
Section 21.3. Returning Strings or Numbers from a Function
Section 21.4. Returning Arrays and Objects from Functions
Section 21.5. Adding a Function to PHP
Section 21.6. Creating Resource Identifiers
Section 21.7. Fetching Resource Identifiers
Section 21.8. Looping Through Arrays
Section 21.9. Creating a PHP Module
Section 21.10. Adding Your File to the PHP Installation
Appendix A. PHP Installation
Appendix B. Troubleshooting with PHP
Common Errors and What They Mean
Techniques to Cut Down on Errors and Bugs
Appendix C. PHP Online Resources
The Official PHP Web Site
The Zend Web Site
PHPBuilder
PHPWizard.net
The PHP Class Repository
Weberdev
DevShed
Appendix D. Migrating to PHP 4
Static Variable and Default Argument Initializers Accept Only Scalar Values
The Scopes of break and continue Are Local to That of an Included File, or an eval'd String
A returnStatement from a required File Does Not Work
Unset Is Now a Statement, Not a Function
"{$" Is Not Supported in Strings
Index
Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу PHP Developer s Cookbook, Hughes S. - fileskachat.com, быстрое и бесплатное скачивание.
Скачать chm
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России.Купить эту книгу
Скачать книгу PHP Developer's Cookbook - Second Edition - Sterling Hughes
Дата публикации:
Теги: программирование :: PHP :: PHP developer's :: обучение PHP :: language constructs :: Zend API databases :: сookbook :: Hughes :: Хьюз :: самоучитель по PHP :: самоучитель PHP :: обучение на примерах :: основы PHP :: PHP для начинающих :: язык программирования PHP :: программирование на PHP :: примеры программирования на PHP :: CGI-сценарии :: сервер Apache :: РНР-функции :: cookie :: сеансы :: FTP :: e-mail :: базы данных :: MySQL :: ООП :: Web-приложения :: строки :: массивы :: книга :: операторы :: скачать
Смотрите также учебники, книги и учебные материалы:
Следующие учебники и книги:
- MySQL and JSP Web Applications, Data-Driven Programming Using Tomcat and MySQL, Turner J.
- MySQL Tutorial, Welling L., Thomson L.
- PHP and MySQL Web Development, Welling L., Thomson L.
- PHP and PostgreSQL, Advanced Web Programming
Предыдущие статьи:
- Sams Teach Yourself PHP, MySQL and Apache in 24 Hours, Meloni J.C.
- Практическое руководство по SQL, Боуман Д.С., Эмерсон С.Л., Дарновски М.
- SQL, Полное руководство, Грофф Д., Вайнберг П.
- Setting Up LAMP: Getting Linux, Apache, MySQL, and PHP Working Together, Rosebrock E., Filson E.