Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Programming PHP, 2nd Edition
A Note Regarding Supplemental Files Foreword Preface
Audience Assumptions This Book Makes Contents of This Book Conventions Used in This Book Using Code Examples Comments and Questions Safari® Enabled Acknowledgments
Rasmus Lerdorf Kevin Tatroe Peter MacIntyre
Dedication
1. Introduction to PHP
1.1. What Does PHP Do? 1.2. A Brief History of PHP
1.2.1. The Evolution of PHP 1.2.2. The Growth of PHP
1.3. Installing PHP 1.4. A Walk Through PHP
1.4.1. Configuration Page 1.4.2. Forms 1.4.3. Databases 1.4.4. Graphics 1.4.5. From the Shell
2. Language Basics
2.1. Lexical Structure
2.1.1. Case Sensitivity 2.1.2. Statements and Semicolons 2.1.3. Whitespace and Line Breaks 2.1.4. Comments
2.1.4.1. Shell-style comments 2.1.4.2. C++ comments 2.1.4.3. C comments
2.1.5. Literals 2.1.6. Identifiers
2.1.6.1. Variable names 2.1.6.2. Function names 2.1.6.3. Class names 2.1.6.4. Constants
2.1.7. Keywords
2.2. Data Types
2.2.1. Integers 2.2.2. Floating-Point Numbers 2.2.3. Strings 2.2.4. Booleans 2.2.5. Arrays 2.2.6. Objects 2.2.7. Resources 2.2.8. NULL
2.3. Variables
2.3.1. Variable Variables 2.3.2. Variable References 2.3.3. Variable Scope
2.3.3.1. Local scope 2.3.3.2. Global scope 2.3.3.3. Static variables 2.3.3.4. Function parameters
2.3.4. Garbage Collection
2.4. Expressions and Operators
2.4.1. Number of Operands 2.4.2. Operator Precedence 2.4.3. Operator Associativity 2.4.4. Implicit Casting 2.4.5. Arithmetic Operators 2.4.6. String Concatenation Operator 2.4.7. Autoincrement and Autodecrement Operators 2.4.8. Comparison Operators 2.4.9. Bitwise Operators 2.4.10. Logical Operators 2.4.11. Casting Operators 2.4.12. Assignment Operators
2.4.12.1. Assignment 2.4.12.2. Assignment with operation
2.4.13. Miscellaneous Operators
2.5. Flow-Control Statements
2.5.1. if 2.5.2. switch 2.5.3. while 2.5.4. for 2.5.5. foreach 2.5.6. declare 2.5.7. exit and return
2.6. Including Code 2.7. Embedding PHP in Web Pages
2.7.1. XML Style 2.7.2. SGML Style 2.7.3. ASP Style 2.7.4. Script Style 2.7.5. Echoing Content Directly
3. Functions
3.1. Calling a Function 3.2. Defining a Function 3.3. Variable Scope
3.3.1. Global Variables 3.3.2. Static Variables
3.4. Function Parameters
3.4.1. Passing Parameters by Value 3.4.2. Passing Parameters by Reference 3.4.3. Default Parameters 3.4.4. Variable Parameters 3.4.5. Missing Parameters
3.5. Return Values 3.6. Variable Functions 3.7. Anonymous Functions
4. Strings
4.1. Quoting String Constants
4.1.1. Variable Interpolation 4.1.2. Single-Quoted Strings 4.1.3. Double-Quoted Strings 4.1.4. Here Documents
4.2. Printing Strings
4.2.1. echo 4.2.2. print( ) 4.2.3. printf( )
4.2.3.1. Format modifiers 4.2.3.2. Type specifiers
4.2.4. print_r( ) and var_dump( )
4.3. Accessing Individual Characters 4.4. Cleaning Strings
4.4.1. Removing Whitespace 4.4.2. Changing Case
4.5. Encoding and Escaping
4.5.1. HTML
4.5.1.1. Entity-quoting all special characters 4.5.1.2. Entity-quoting only HTML syntax characters 4.5.1.3. Removing HTML tags 4.5.1.4. Extracting meta tags
4.5.2. URLs
4.5.2.1. RFC 1738 encoding and decoding 4.5.2.2. Query-string encoding
4.5.3. SQL 4.5.4. C-String Encoding
4.6. Comparing Strings
4.6.1. Exact Comparisons 4.6.2. Approximate Equality
4.7. Manipulating and Searching Strings
4.7.1. Substrings 4.7.2. Miscellaneous String Functions 4.7.3. Decomposing a String
4.7.3.1. Exploding and imploding 4.7.3.2. Tokenizing 4.7.3.3. sscanf( )
4.7.4. String-Searching Functions
4.7.4.1. Searches returning position 4.7.4.2. Searches returning rest of string 4.7.4.3. Searches using masks 4.7.4.4. Decomposing URLs
4.8. Regular Expressions
4.8.1. The Basics 4.8.2. Character Classes 4.8.3. Alternatives 4.8.4. Repeating Sequences 4.8.5. Subpatterns
4.9. POSIX-Style Regular Expressions
4.9.1. Character Classes 4.9.2. Anchors 4.9.3. Functions
4.9.3.1. Matching 4.9.3.2. Replacing 4.9.3.3. Splitting
4.10. Perl-Compatible Regular Expressions
4.10.1. Delimiters 4.10.2. Match Behavior 4.10.3. Character Classes 4.10.4. Anchors 4.10.5. Quantifiers and Greed 4.10.6. Non-Capturing Groups 4.10.7. Backreferences 4.10.8. Trailing Options 4.10.9. Inline Options 4.10.10. Lookahead and Lookbehind 4.10.11. Cut 4.10.12. Conditional Expressions 4.10.13. Functions
4.10.13.1. Matching 4.10.13.2. Replacing 4.10.13.3. Splitting 4.10.13.4. Filtering an array with a regular expression 4.10.13.5. Quoting for regular expressions
4.10.14. Differences from Perl Regular Expressions
5. Arrays
5.1. Indexed Versus Associative Arrays 5.2. Identifying Elements of an Array 5.3. Storing Data in Arrays
5.3.1. Adding Values to the End of an Array 5.3.2. Assigning a Range of Values 5.3.3. Getting the Size of an Array 5.3.4. Padding an Array
5.4. Multidimensional Arrays 5.5. Extracting Multiple Values
5.5.1. Slicing an Array 5.5.2. Splitting an Array into Chunks 5.5.3. Keys and Values 5.5.4. Checking Whether an Element Exists 5.5.5. Removing and Inserting Elements in an Array
5.6. Converting Between Arrays and Variables
5.6.1. Creating Variables from an Array 5.6.2. Creating an Array from Variables
5.7. Traversing Arrays
5.7.1. The foreach Construct 5.7.2. The Iterator Functions 5.7.3. Using a for Loop 5.7.4. Calling a Function for Each Array Element 5.7.5. Reducing an Array 5.7.6. Searching for Values
5.8. Sorting
5.8.1. Sorting One Array at a Time 5.8.2. Natural-Order Sorting 5.8.3. Sorting Multiple Arrays at Once 5.8.4. Reversing Arrays 5.8.5. Randomizing Order
5.9. Acting on Entire Arrays
5.9.1. Calculating the Sum of an Array 5.9.2. Merging Two Arrays 5.9.3. Calculating the Difference Between Two Arrays 5.9.4. Filtering Elements from an Array
5.10. Using Arrays
5.10.1. Sets 5.10.2. Stacks
6. Objects
6.1. Terminology 6.2. Creating an Object 6.3. Accessing Properties and Methods 6.4. Declaring a Class
6.4.1. Declaring Methods 6.4.2. Declaring Properties 6.4.3. Declaring Constants 6.4.4. Inheritance 6.4.5. Interfaces 6.4.6. Abstract Methods 6.4.7. Constructors 6.4.8. Destructors
6.5. Introspection
6.5.1. Examining Classes 6.5.2. Examining an Object 6.5.3. Sample Introspection Program
6.6. Serialization
7. Web Techniques
7.1. HTTP Basics 7.2. Variables 7.3. Server Information 7.4. Processing Forms
7.4.1. Methods 7.4.2. Parameters 7.4.3. Automatic Quoting of Parameters 7.4.4. Self-Processing Pages 7.4.5. Sticky Forms 7.4.6. Multivalued Parameters 7.4.7. Sticky Multivalued Parameters 7.4.8. File Uploads 7.4.9. Form Validation
7.5. Setting Response Headers
7.5.1. Different Content Types 7.5.2. Redirections 7.5.3. Expiration 7.5.4. Authentication
7.6. Maintaining State
7.6.1. Cookies 7.6.2. Sessions
7.6.2.1. Session basics 7.6.2.2. Alternatives to cookies 7.6.2.3. Custom storage
7.6.3. Combining Cookies and Sessions
7.7. SSL
8. Databases
8.1. Using PHP to Access a Database 8.2. Relational Databases and SQL 8.3. PEAR DB Basics
8.3.1. Data Source Names 8.3.2. Connecting 8.3.3. Error Checking 8.3.4. Issuing a Query 8.3.5. Fetching Results from a Query
8.3.5.1. Returning the row 8.3.5.2. Storing the row 8.3.5.3. Inside a row array 8.3.5.4. Finishing the result
8.3.6. Disconnecting
8.4. Advanced Database Techniques
8.4.1. Placeholders 8.4.2. Prepare/Execute 8.4.3. Shortcuts 8.4.4. Details About a Query Response 8.4.5. Sequences 8.4.6. Metadata 8.4.7. Transactions
8.5. Sample Application
8.5.1. Database Tables 8.5.2. Database Connection 8.5.3. Administrator's Page 8.5.4. Adding a Business 8.5.5. Displaying the Database 8.5.6. PHP Data Objects
8.5.6.1. Making a connection 8.5.6.2. Interaction with the database 8.5.6.3. PDO and prepared statements
9. Graphics
9.1. Embedding an Image in a Page 9.2. The GD Extension 9.3. Basic Graphics Concepts 9.4. Creating and Drawing Images
9.4.1. The Structure of a Graphics Program 9.4.2. Changing the Output Format 9.4.3. Testing for Supported Image Formats 9.4.4. Reading an Existing File 9.4.5. Basic Drawing Functions
9.5. Images with Text
9.5.1. Fonts 9.5.2. TrueType Fonts
9.6. Dynamically Generated Buttons
9.6.1. Caching the Dynamically Generated Buttons 9.6.2. A Faster Cache
9.7. Scaling Images 9.8. Color Handling
9.8.1. Using the Alpha Channel 9.8.2. Identifying Colors 9.8.3. True Color Color Indexes 9.8.4. Text Representation of an Image
10. PDF
10.1. PDF Extensions 10.2. Documents and Pages
10.2.1. A Simple Example 10.2.2. Initializing the Document 10.2.3. Outputting Basic Text - Cells
10.3. Text
10.3.1. Coordinates 10.3.2. Text Attributes 10.3.3. Page Headers, Footers, and Class Extension 10.3.4. Images and Links 10.3.5. Tables and Data
11. XML
11.1. Lightning Guide to XML 11.2. Generating XML 11.3. Parsing XML
11.3.1. Element Handlers 11.3.2. Character Data Handler 11.3.3. Processing Instructions 11.3.4. Entity Handlers
11.3.4.1. External entities 11.3.4.2. Unparsed entities
11.3.5. Default Handler 11.3.6. Options
11.3.6.1. Character encoding 11.3.6.2. Case folding
11.3.7. Using the Parser 11.3.8. Errors 11.3.9. Methods as Handlers 11.3.10. Sample Parsing Application
11.4. Parsing XML with DOM 11.5. Parsing XML with SimpleXML 11.6. Transforming XML with XSLT 11.7. Web Services
11.7.1. Servers 11.7.2. Clients
12. Security
12.1. Filter Input
12.1.1. SQL Injection
12.2. Escape Output
12.2.1. Filenames
12.2.1.1. Check for relative paths
12.3. Cross-Site Scripting 12.4. Session Fixation 12.5. File Uploads
12.5.1. Distrust Browser-Supplied Filenames 12.5.2. Beware of Filling Your Filesystem 12.5.3. Surviving register_globals
12.6. File Access
12.6.1. Restrict Filesystem Access to a Specific Directory 12.6.2. Get It Right the First Time 12.6.3. Don't Use Files 12.6.4. Session Files 12.6.5. Concealing PHP Libraries
12.7. PHP Code 12.8. Shell Commands 12.9. More Information 12.10. Security Recap
13. Application Techniques
13.1. Code Libraries 13.2. Templating Systems 13.3. Handling Output
13.3.1. Output Buffering 13.3.2. Compressing Output
13.4. Error Handling
13.4.1. Error Reporting 13.4.2. Error Suppression 13.4.3. Triggering Errors 13.4.4. Defining Error Handlers
13.4.4.1. Logging in error handlers 13.4.4.2. Output buffering in error handlers
13.5. Performance Tuning
13.5.1. Benchmarking 13.5.2. Profiling 13.5.3. Optimizing Execution Time 13.5.4. Optimizing Memory Requirements 13.5.5. Reverse Proxies and Replication
13.5.5.1. Reverse-proxy cache 13.5.5.2. Load balancing and redirection 13.5.5.3. MySQL replication 13.5.5.4. Putting it all together
14. Extending PHP
14.1. Architectural Overview 14.2. What You'll Need
14.2.1. The PHP Source 14.2.2. Software Tools
14.3. Building Your First Extensions
14.3.1. Command-Line PHP 14.3.2. Planning Your Extension 14.3.3. Creating a Skeleton Extension 14.3.4. Fleshing Out the Skeleton 14.3.5. Compiling Your Extension
14.3.5.1. Standalone extensions 14.3.5.2. Compiling the extension into PHP
14.3.6. Testing Your Extension
14.4. The config.m4 File
14.4.1. No External Dependencies 14.4.2. External Dependencies
14.5. Memory Management 14.6. The pval /zval Data Type
14.6.1. MAKE_STD_ZVAL( ) 14.6.2. SEPARATE_ZVAL( ) 14.6.3. zval_copy_ctor( ) 14.6.4. Accessor Macros
14.7. Parameter Handling
14.7.1. A Simple Example 14.7.2. A More Complex Example 14.7.3. An Example with Variable Argument List
14.8. Returning Values
14.8.1. Simple Types 14.8.2. Arrays 14.8.3. Objects
14.9. References 14.10. Global Variables
14.10.1. SAPI Globals (SG) 14.10.2. Executor Globals (EG ) 14.10.3. Internal Extension Globals
14.11. Creating Variables 14.12. Extension INI Entries 14.13. Resources 14.14. Where to Go from Here
15. PHP on Windows
15.1. Installing and Configuring PHP on Windows
15.1.1. Going Straight to the Source 15.1.2. Configuring PHP with a Web Server
15.1.2.1. Configuration common to all Microsoft installations 15.1.2.2. Manually configuring Apache 15.1.2.3. Other installers and prepackaged distributions
15.1.3. Adding Extensions to the Base Distribution 15.1.4. Adding the MySQL Extension
15.2. Writing Portable Code for Windows and Unix
15.2.1. Determining the Platform 15.2.2. Handling Paths Across Platforms 15.2.3. The Environment 15.2.4. Sending Mail 15.2.5. End-of-Line Handling 15.2.6. End-of-File Handling 15.2.7. External Commands 15.2.8. Common Platform-Specific Extensions
15.3. Interfacing with COM
15.3.1. Background 15.3.2. PHP Functions 15.3.3. Determining the API 15.3.4. Completing a Word Document
15.4. Interacting with ODBC Data Sources
15.4.1. Configuring a DSN 15.4.2. Working with Access
A. Function Reference
A.1. PHP Functions by Category
A.1.1. Arrays A.1.2. Classes and Objects A.1.3. Date and Time A.1.4. Errors and Logging A.1.5. Files, Directories, and Filesystem A.1.6. Functions A.1.7. HTTP A.1.8. Images A.1.9. Mail A.1.10. Math A.1.11. Network A.1.12. Output Control A.1.13. PHP Options/Info A.1.14. Program Execution A.1.15. Strings A.1.16. Type Functions A.1.17. URLs A.1.18. Variable Functions
A.2. Alphabetical Listing of PHP Functions
abs acos acosh addcslashes addslashes Array array_change_key_case array_chunk array_combine array_count_values array_diff array_diff_assoc array_diff_uassoc array_fill array_filter array_flip array_intersect array_intersect_assoc array_intersect_uassoc array_key_exists array_keys array_map array_merge array_merge_recursive array_multisort array_pad array_pop array_push array_rand array_reduce array_reverse array_search array_shift array_slice array_splice array_sum array_udiff array_udiff_assoc array_udiff_uassoc array_uintersect array_uintersect_assoc array_uintersect_uassoc array_unique array_unshift array_values array_walk array_walk_recursive arsort asin asinh asort assert assert_options atan atan2 atanh base64_decode base64_encode base_convert basename bin2hex bindec call_user_func call_user_func_array call_user_method call_user_method_array ceil chdir checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists class_implements class_parents clearstatcache closedir closelog compact connection_aborted connection_status constant convert_cyr_string convert_uudecode convert_uuencode copy cos cosh count count_chars crc32 create_function crypt ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_graph ctype_lower ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit current date date_sunrise date_sunset debug_backtrace debug_print_backtrace decbin dechex decoct define defined define_syslog_variables deg2rad dir dirname diskfreespace disk_free_space disk_total_space dl dns_check_record dns_get_mx doubleval each echo empty end ereg ereg_replace eregi eregi_replace error_log error_reporting escapeshellarg escapeshellcmd exec exp explode extension_loaded extract fclose feof fflush fgetc fgetcsv fgets fgetss file file_exists fileatime filectime file_get_contents filegroup fileinode filemtime fileowner fileperms file_put_contents filesize filetype floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputs fread fscanf fseek fsockopen fstat ftell ftruncate func_get_arg func_get_args func_num_args function_exists fwrite get_browser get_cfg_var get_class get_class_methods get_class_vars get_current_user get_declared_classes get_declared_interfaces get_defined_constants get_defined_functions get_defined_vars get_extension_funcs get_headers get_html_translation_table getimagesize get_included_files get_include_path get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_meta_tags getmygid getmyuid get_object_vars get_parent_class get_required_files get_resource_type getcwd getdate getenv gethostbyaddr gethostbyname gethostbynamel getlastmod getmxrr getmyinode getmypid getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettimeofday gettype glob gmdate gmmktime gmstrftime header headers_list headers_sent hebrev hebrevc hexdec highlight_file highlight_string htmlentities html_entity_decode htmlspecialchars http_build_query hypot idate ignore_user_abort image_type_to_mime_type implode import_request_variables in_array ini_alter ini_get ini_get_all ini_restore ini_set interface_exists intval ip2long iptcparse is_a is_array is_bool is_callable is_dir is_double is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_string is_subclass_of is_uploaded_file is_writable is_writeable isset join key krsort ksort lcg_value levenshtein link linkinfo list localeconv localtime log log10 log1p long2ip lstat ltrim mail max md5 md5_file metaphone method_exists microtime min mkdir mktime money_format move_uploaded_file mt_getrandmax mt_rand mt_srand natcasesort natsort next nl_langinfo nl2br number_format ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_gzhandler ob_implicit_flush ob_list_handlers ob_start octdec opendir openlog ord output_add_rewrite_var output_reset_rewrite_vars pack parse_ini_file parse_str parse_url passthru pathinfo pclose pfsockopen php_ini_scanned_files php_logo_guid php_sapi_name php_uname phpcredits phpinfo phpversion pi popen pos pow prev print print_r printf putenv quoted_printable_decode quotemeta rad2deg rand range rawurldecode rawurlencode readdir readfile readlink realpath register_shutdown_function register_tick_function rename reset restore_error_handler restore_exception_handler restore_include_path rewind rewinddir rmdir round rsort rtrim serialize set_error_handler set_exception_handler set_file_buffer set_include_path set_magic_quotes_runtime set_time_limit setcookie setlocale setrawcookie settype sha1 sha1_file shell_exec show_source shuffle similar_text sin sinh sizeof sleep socket_get_status socket_set_blocking socket_set_timeout sort soundex split spliti sprintf sql_regcase sqrt srand sscanf stat str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strftime stripcslashes stripslashes strip_tags stripos stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime strtoupper strtr strval substr substr_compare substr_count substr_replace symlink syslog system tan tanh tempnam time time_nanosleep tmpfile touch trigger_error trim uasort ucfirst ucwords uksort umask uniqid unlink unpack unregister_tick_function unserialize unset urldecode urlencode user_error usleep usort var_dump var_export version_compare vprintf vsprintf wordwrap zend_logo_guid zend_version
B. Extension Overview
B.1. Optional Extensions Listing
BCMath Arbitrary Precision Mathematics Calendar cPDF COM ctype CURL dBase DBM-Style Database Abstraction dbx DOM XML EXIF FrontBase FDF File Alteration Monitor filePro FTP Gd/gd2 gettext GMP Hyperwave iconv IMAP , POP3 , and NNTP Informix Ingres II InterBase IRC Gateway Java LDAP mcrypt MCVE mhash Microsoft SQL Server Ming mnoGoSearch msession mSQL MySQL ODBC openssl Oracle OvrimosSQL Verisign Payflow Pro PostgreSQL pspell Readline Recode shmop SNMP sockets Sybase System V Semaphore and Shared Memory tidy WDDX XML Parser YAZ YP/NIS zlib Compression
About the Authors Colophon
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion