PHP is a simple yet powerful open source scripting language that has become a big player in web development. Over a million web sites, from large corporate sites to small personal sites, are using PHP to serve dynamic web content. PHP's broad feature set, approachable syntax, and support for different operating systems and web servers make it an ideal language for rapid web development.The PHP Cookbook is a collection of problems, solutions, and practical examples for PHP programmers. The book contains a unique and extensive collection of best practices for everyday PHP programming dilemmas. For every problem addressed in the book, there's a worked-out solution or "recipe" -- short, focused pieces of code that you can insert directly into your applications. But this book offers more than cut-and-paste code. You also get explanations of how and why the code works, so you can learn to adapt the problem-solving techniques to similar situations.The recipes in the PHP Cookbook range from simple tasks, such as sending a database query and fetching URLs, to entire programs that demonstrate complex tasks, such as printing HTML tables and generating bar charts. This book contains over 250 recipes on the following topics:
Le informazioni nella sezione "Riassunto" possono far riferimento a edizioni diverse di questo titolo.
is an independent software development and strategic technology consultant. He was a co-founder and the Chief Technology Officer of Student.Com and TVGrid.Com. At both companies, David oversaw the architecture and development of varied systems to deliver personalized dynamic content to users around the world. After discovering PHP as a solution to his web programming needs in 1996, he created the PX (http://px.sklar.com/), which enables PHP users to exchange programs. Since then, he has continued to rely on PHP for personal and professional projects. When away from the computer, David eats mini-donuts, plays records, and likes to cook. He lives in New York City and has a degree in Computer Science from Yale University.
Adam Trachtenberg has an MBA from Columbia Business School. At business school, he focused on general management and operations, with an emphasis on the field of technology. Adam also has a BA from Columbia University. As an undergraduate, he majored in mathematics and his other studies included computer science and Chinese. Before returning to school, he co-founded and served as Vice President for Development at two companies, Student.Com and TVGrid.Com. At both firms, he led the front- and middle-end web site design and development, worked on corporate planning and strategy, and served as liaison between the product and marketing teams. During study breaks, Adam enjoys playing squash, reading fiction, and eating in New York City's many wonderful restaurants. He wishes he was a better at playing pool, knew the constellations, and was handy around the house.
Preface; Who This Book Is For; What Is in This Book; Other Resources; Conventions Used in This Book; Comments and Questions; Acknowledgments; Chapter 1: Strings; 1.1 Introduction; 1.2 Accessing Substrings; 1.3 Replacing Substrings; 1.4 Processing a String One Character at a Time; 1.5 Reversing a String by Word or Character; 1.6 Expanding and Compressing Tabs; 1.7 Controlling Case; 1.8 Interpolating Functions and Expressions Within Strings; 1.9 Trimming Blanks from a String; 1.10 Parsing Comma-Separated Data; 1.11 Parsing Fixed-Width Delimited Data; 1.12 Taking Strings Apart; 1.13 Wrapping Text at a Certain Line Length; 1.14 Storing Binary Data in Strings; Chapter 2: Numbers; 2.1 Introduction; 2.2 Checking Whether a String Contains a Valid Number; 2.3 Comparing Floating-Point Numbers; 2.4 Rounding Floating-Point Numbers; 2.5 Operating on a Series of Integers; 2.6 Generating Random Numbers Within a Range; 2.7 Generating Biased Random Numbers; 2.8 Taking Logarithms; 2.9 Calculating Exponents; 2.10 Formatting Numbers; 2.11 Printing Correct Plurals; 2.12 Calculating Trigonometric Functions; 2.13 Doing Trigonometry in Degrees, not Radians; 2.14 Handling Very Large or Very Small Numbers; 2.15 Converting Between Bases; 2.16 Calculating Using Numbers in Bases Other Than Decimal; Chapter 3: Dates and Times; 3.1 Introduction; 3.2 Finding the Current Date and Time; 3.3 Converting Time and Date Parts to an Epoch Timestamp; 3.4 Converting an Epoch Timestamp to Time and Date Parts; 3.5 Printing a Date or Time in a Specified Format; 3.6 Finding the Difference of Two Dates; 3.7 Finding the Difference of Two Dates with Julian Days; 3.8 Finding the Day in a Week, Month, Year, or the Week Number in a Year; 3.9 Validating a Date; 3.10 Parsing Dates and Times from Strings; 3.11 Adding to or Subtracting from a Date; 3.12 Calculating Time with Time Zones; 3.13 Accounting for Daylight Saving Time; 3.14 Generating a High-Precision Time; 3.15 Generating Time Ranges; 3.16 Using Non-Gregorian Calendars; 3.17 Program: Calendar; Chapter 4: Arrays; 4.1 Introduction; 4.2 Specifying an Array Not Beginning at Element 0; 4.3 Storing Multiple Elements per Key in an Array; 4.4 Initializing an Array to a Range of Integers; 4.5 Iterating Through an Array; 4.6 Deleting Elements from an Array; 4.7 Changing Array Size; 4.8 Appending One Array to Another; 4.9 Turning an Array into a String; 4.10 Printing an Array with Commas; 4.11 Checking if a Key Is in an Array; 4.12 Checking if an Element Is in an Array; 4.13 Finding the Position of an Element in an Array; 4.14 Finding Elements That Pass a Certain Test; 4.15 Finding the Largest or Smallest Valued Element in an Array; 4.16 Reversing an Array; 4.17 Sorting an Array; 4.18 Sorting an Array by a Computable Field; 4.19 Sorting Multiple Arrays; 4.20 Sorting an Array Using a Method Instead of a Function; 4.21 Randomizing an Array; 4.22 Shuffling a Deck of Cards; 4.23 Removing Duplicate Elements from an Array; 4.24 Finding the Union, Intersection, or Difference of Two Arrays; 4.25 Finding All Element Combinations of an Array; 4.26 Finding All Permutations of an Array; 4.27 Program: Printing an Array in a Horizontally Columned HTML Table; Chapter 5: Variables; 5.1 Introduction; 5.2 Avoiding == Versus = Confusion; 5.3 Establishing a Default Value; 5.4 Exchanging Values Without Using Temporary Variables; 5.5 Creating a Dynamic Variable Name; 5.6 Using Static Variables; 5.7 Sharing Variables Between Processes; 5.8 Encapsulating Complex Data Types as a String; 5.9 Dumping Variable Contents as Strings; Chapter 6: Functions; 6.1 Introduction; 6.2 Accessing Function Parameters; 6.3 Setting Default Values for Function Parameters; 6.4 Passing Values by Reference; 6.5 Using Named Parameters; 6.6 Creating Functions That Take a Variable Number of Arguments; 6.7 Returning Values by Reference; 6.8 Returning More Than One Value; 6.9 Skipping Selected Return Values; 6.10 Returning Failure; 6.11 Calling Variable Functions; 6.12 Accessing a Global Variable Inside a Function; 6.13 Creating Dynamic Functions; Chapter 7: Classes and Objects; 7.1 Introduction; 7.2 Instantiating Objects; 7.3 Defining Object Constructors; 7.4 Destroying an Object; 7.5 Cloning Objects; 7.6 Assigning Object References; 7.7 Calling Methods on an Object Returned by Another Method; 7.8 Accessing Overridden Methods; 7.9 Using Property Overloading; 7.10 Using Method Polymorphism; 7.11 Finding the Methods and Properties of an Object; 7.12 Adding Properties to a Base Object; 7.13 Creating a Class Dynamically; 7.14 Instantiating an Object Dynamically; Chapter 8: Web Basics; 8.1 Introduction; 8.2 Setting Cookies; 8.3 Reading Cookie Values; 8.4 Deleting Cookies; 8.5 Redirecting to a Different Location; 8.6 Using Session Tracking; 8.7 Storing Sessions in a Database; 8.8 Detecting Different Browsers; 8.9 Building a GET Query String; 8.10 Using HTTP Basic Authentication; 8.11 Using Cookie Authentication; 8.12 Flushing Output to the Browser; 8.13 Buffering Output to the Browser; 8.14 Compressing Web Output with gzip; 8.15 Hiding Error Messages from Users; 8.16 Tuning Error Handling; 8.17 Using a Custom Error Handler; 8.18 Logging Errors; 8.19 Eliminating “headers already sent” Errors; 8.20 Logging Debugging Information; 8.21 Reading Environment Variables; 8.22 Setting Environment Variables; 8.23 Reading Configuration Variables; 8.24 Setting Configuration Variables; 8.25 Communicating Within Apache; 8.26 Profiling Code; 8.27 Program: Website Account (De)activator; 8.28 Program: Abusive User Checker; Chapter 9: Forms; 9.1 Introduction; 9.2 Processing Form Input; 9.3 Validating Form Input; 9.4 Working with Multipage Forms; 9.5 Redisplaying Forms with Preserved Information and Error Messages; 9.6 Guarding Against Multiple Submission of the Same Form; 9.7 Processing Uploaded Files; 9.8 Securing PHP’s Form Processing; 9.9 Escaping Control Characters from User Data; 9.10 Handling Remote Variables with Periods in Their Names; 9.11 Using Form Elements with Multiple Options; 9.12 Creating Dropdown Menus Based on the Current Date; Chapter 10: Database Access; 10.1 Introduction; 10.2 Using Text-File Databases; 10.3 Using DBM Databases; 10.4 Connecting to a SQL Database; 10.5 Querying a SQL Database; 10.6 Retrieving Rows Without a Loop; 10.7 Modifying Data in a SQL Database; 10.8 Repeating Queries Efficiently; 10.9 Finding the Number of Rows Returned by a Query; 10.10 Escaping Quotes; 10.11 Logging Debugging Information and Errors; 10.12 Assigning Unique ID Values Automatically; 10.13 Building Queries Programmatically; 10.14 Making Paginated Links for a Series of Records; 10.15 Caching Queries and Results; 10.16 Program: Storing a Threaded Message Board; Chapter 11: Web Automation; 11.1 Introduction; 11.2 Fetching a URL with the GET Method; 11.3 Fetching a URL with the POST Method; 11.4 Fetching a URL with Cookies; 11.5 Fetching a URL with Headers; 11.6 Fetching an HTTPS URL; 11.7 Debugging the Raw HTTP Exchange; 11.8 Marking Up a Web Page; 11.9 Extracting Links from an HTML File; 11.10 Converting ASCII to HTML; 11.11 Converting HTML to ASCII; 11.12 Removing HTML and PHP Tags; 11.13 Using Smarty Templates; 11.14 Parsing a Web Server Log File; 11.15 Program: Finding Stale Links; 11.16 Program: Finding Fresh Links; Chapter 12: XML; 12.1 Introduction; 12.2 Generating XML Manually; 12.3 Generating XML with the DOM; 12.4 Parsing XML with the DOM; 12.5 Parsing XML with SAX; 12.6 Transforming XML with XSLT; 12.7 Sending XML-RPC Requests; 12.8 Receiving XML-RPC Requests; 12.9 Sending SOAP Requests; 12.10 Receiving SOAP Requests; 12.11 Exchanging Data with WDDX; 12.12 Reading RSS Feeds; Chapter 13: Regular Expressions; 13.1 Introduction; 13.2 Switching From ereg to preg; 13.3 Matching Words; 13.4 Finding the nth Occurrence of a Match; 13.5 Choosing Greedy or Nongreedy Matches; 13.6 Matching a Valid Email Address; 13.7 Finding All Lines in a File That Match a Pattern; 13.8 Capturing Text Inside HTML Tags; 13.9 Escaping Special Characters in a Regular Expression; 13.10 Reading Records with a Pattern Separator; Chapter 14: Encryption and Security; 14.1 Introduction; 14.2 Keeping Passwords Out of Your Site Files; 14.3 Obscuring Data with Encoding; 14.4 Verifying Data with Hashes; 14.5 Storing Passwords; 14.6 Checking Password Strength; 14.7 Dealing with Lost Passwords; 14.8 Encrypting and Decrypting Data; 14.9 Storing Encrypted Data in a File or Database; 14.10 Sharing Encrypted Data with Another Web Site; 14.11 Detecting SSL; 14.12 Encrypting Email with GPG; Chapter 15: Graphics; 15.1 Introduction; 15.2 Drawing Lines, Rectangles, and Polygons; 15.3 Drawing Arcs, Ellipses, and Circles; 15.4 Drawing with Patterned Lines; 15.5 Drawing Text; 15.6 Drawing Centered Text; 15.7 Building Dynamic Images; 15.8 Getting and Setting a Transparent Color; 15.9 Serving Images Securely; 15.10 Program: Generating Bar Charts from Poll Results; Chapter 16: Internationalization and Localization; 16.1 Introduction; 16.2 Listing Available Locales; 16.3 Using a Particular Locale; 16.4 Setting the Default Locale; 16.5 Localizing Text Messages; 16.6 Localizing Dates and Times; 16.7 Localizing Currency Values; 16.8 Localizing Images; 16.9 Localizing Included Files; 16.10 Managing Localization Resources; 16.11 Using gettext; 16.12 Reading or Writing Unicode Characters; Chapter 17: Internet Services; 17.1 Introduction; 17.2 Sending Mail; 17.3 Sending MIME Mail; 17.4 Reading Mail with IMAP or POP3; 17.5 Posting Messages to Usenet Newsgroups; 17.6 Reading Usenet News Messages; 17.7 Getting and Putting Files with FTP; 17.8 Looking Up Addresses with LDAP; 17.9 Using LDAP for User Authentication; 17.10 Performing DNS Lookups; 17.11 Checking if a Host Is Alive; 17.12 Getting Information About a Domain Name; Chapter 18: Files; 18.1 Introduction; 18.2 Creating or Opening a Local File; 18.3 Creating a Temporary File; 18.4 Opening a Remote File; 18.5 Reading from Standard Input; 18.6 Reading a File into a String; 18.7 Counting Lines, Paragraphs, or Records in a File; 18.8 Processing Every Word in a File; 18.9 Reading a Particular Line in a File; 18.10 Processing a File Backward by Line or Paragraph; 18.11 Picking a Random Line from a File; 18.12 Randomizing All Lines in a File; 18.13 Processing Variable Length Text Fields; 18.14 Reading Configuration Files; 18.15 Reading from or Writing to a Specific Location in a File; 18.16 Removing the Last Line of a File; 18.17 Modifying a File in Place Without a Temporary File; 18.18 Flushing Output to a File; 18.19 Writing to Standard Output; 18.20 Writing to Many Filehandles Simultaneously; 18.21 Escaping Shell Metacharacters; 18.22 Passing Input to a Program; 18.23 Reading Standard Output from a Program; 18.24 Reading Standard Error from a Program; 18.25 Locking a File; 18.26 Reading and Writing Compressed Files; 18.27 Program: Unzip; Chapter 19: Directories; 19.1 Introduction; 19.2 Getting and Setting File Timestamps; 19.3 Getting File Information; 19.4 Changing File Permissions or Ownership; 19.5 Splitting a Filename into Its Component Parts; 19.6 Deleting a File; 19.7 Copying or Moving a File; 19.8 Processing All Files in a Directory Recursively; 19.9 Getting a List of Filenames Matching a Pattern; 19.10 Processing All Files in a Directory; 19.11 Making New Directories; 19.12 Removing a Directory and Its Contents; 19.13 Program: Web Server Directory Listing; 19.14 Program: Site Search; Chapter 20: Client-Side PHP; 20.1 Introduction; 20.2 Parsing Program Arguments; 20.3 Parsing Program Arguments with getopt; 20.4 Reading from the Keyboard; 20.5 Reading Passwords; 20.6 Displaying a GUI Widget in a Window; 20.7 Displaying Multiple GUI Widgets in a Window; 20.8 Responding to User Actions; 20.9 Displaying Menus; 20.10 Program: Command Shell; 20.11 Program: Displaying Weather Conditions; Chapter 21: PEAR; 21.1 Introduction; 21.2 Using the PEAR Package Manager; 21.3 Finding PEAR Packages; 21.4 Finding Information About a Package; 21.5 Installing PEAR Packages; 21.6 Installing PECL Packages; 21.7 Upgrading PEAR Packages; 21.8 Uninstalling PEAR Packages; 21.9 Documenting Classes with PHPDoc; Colophon;
Le informazioni nella sezione "Su questo libro" possono far riferimento a edizioni diverse di questo titolo.
GRATIS per la spedizione in U.S.A.
Destinazione, tempi e costiGRATIS per la spedizione in U.S.A.
Destinazione, tempi e costiDa: Wonder Book, Frederick, MD, U.S.A.
Condizione: Very Good. Very Good condition. A copy that may have a few cosmetic defects. May also contain light spine creasing or a few markings such as an owner's name, short gifter's inscription or light stamp. Bundled media such as CDs, DVDs, floppy disks or access codes may not be included. Codice articolo T10C-02895
Quantità: 1 disponibili
Da: Wonder Book, Frederick, MD, U.S.A.
Condizione: Good. Good condition. A copy that has been read but remains intact. May contain markings such as bookplates, stamps, limited notes and highlighting, or a few light stains. Codice articolo F12A-01860
Quantità: 2 disponibili
Da: Once Upon A Time Books, Siloam Springs, AR, U.S.A.
Paperback. Condizione: Good. This is a used book in good condition and may show some signs of use or wear . This is a used book in good condition and may show some signs of use or wear . Codice articolo mon0000546688
Quantità: 1 disponibili
Da: SecondSale, Montgomery, IL, U.S.A.
Condizione: Very Good. Item in very good condition! Textbooks may not include supplemental items i.e. CDs, access codes etc. Codice articolo 00073731390
Quantità: 1 disponibili
Da: SecondSale, Montgomery, IL, U.S.A.
Condizione: Good. Item in good condition. Textbooks may not include supplemental items i.e. CDs, access codes etc. Codice articolo 00070127735
Quantità: 1 disponibili
Da: Better World Books, Mishawaka, IN, U.S.A.
Condizione: Good. Used book that is in clean, average condition without any missing pages. Codice articolo 1442615-6
Quantità: 1 disponibili
Da: Half Price Books Inc., Dallas, TX, U.S.A.
paperback. Condizione: Very Good. Connecting readers with great books since 1972! Used books may not include companion materials, and may have some shelf wear or limited writing. We ship orders daily and Customer Service is our top priority! Codice articolo S_433699854
Quantità: 1 disponibili
Da: WorldofBooks, Goring-By-Sea, WS, Regno Unito
Paperback. Condizione: Very Good. The book has been read, but is in excellent condition. Pages are intact and not marred by notes or highlighting. The spine remains undamaged. Codice articolo GOR003179931
Quantità: 5 disponibili
Da: AwesomeBooks, Wallingford, Regno Unito
Paperback. Condizione: Very Good. PHP Cookbook: 1 This book is in very good condition and will be shipped within 24 hours of ordering. The cover may have some limited signs of wear but the pages are clean, intact and the spine remains undamaged. This book has clearly been well maintained and looked after thus far. Money back guarantee if you are not satisfied. See all our books here, order more than 1 book and get discounted shipping. Codice articolo 7719-9781565926813
Quantità: 1 disponibili
Da: Bahamut Media, Reading, Regno Unito
Paperback. Condizione: Very Good. This book is in very good condition and will be shipped within 24 hours of ordering. The cover may have some limited signs of wear but the pages are clean, intact and the spine remains undamaged. This book has clearly been well maintained and looked after thus far. Money back guarantee if you are not satisfied. See all our books here, order more than 1 book and get discounted shipping. Codice articolo 6545-9781565926813
Quantità: 1 disponibili