If you're a PHP developer looking for proven solutions to common problems, this cookbook provides code recipes to help you resolve numerous scenarios. By leveraging modern versions of PHP through version 8.1, these self-contained recipes provide fully realized solutions that can help you solve similar problems in your day-to-day work.
Whether you're new to development or merely new to PHP, these recipes will help you unpack the most powerful features of this programming language. Author Eric Mann, a regular contributor to php(architec magazine, frequently makes presentations on software architecture and has built scalable projects for startups and Fortune 500 companies alike.
PHP is well known as a loosely-typed language. This sets the language apart as developers are not required to identify the type of a specific variable when it’s created or even when it’s called. The interpreter behind PHP will identify the right type when the variable is used and, in many cases, transparently cast the variable as a different type at runtime.
Nearly every developer who builds modern web applications has an opinion on PHP. Some love the language. Some loathe the language. Most are familiar with its impact and applications written in the language. This is due to PHP powering over 75% of websites1 for which the language in which they are written is known. Given the sprawling size of the Internet, that’s a lot of PHP code in the wild. Admittedly, not all PHP code is good code. Anyone who has written PHP code has seen the good, the bad, and the ugly presented by the language. It’s a remarkable easy language to work with, which is cause for both the sheer power behind its market dominance and for the missteps made by many engineers writing questionable code.
Unlike fully compiled languages that enforce strict typing and memory management, PHP is an interpreted language that is incredibly forgiving of programming mistakes. In many cases, even a grievous programming error will result in a warning while PHP continues to happily execute the program regardless. This is great for developers learning a new language as an innocent error won’t necessary crash the application. But the forgiving nature is a double-edged swords of sorts. As even “bad code” will run, many developers publish that code and it’s easily reused by unsuspecting beginners.
Learn the type system of modern PHP
Build efficient applications composed of functions and objects
Understand key concepts such as encryption, error handling, debugging, and performance tuning
Explore the PHP package/extension ecosystem
Learn how to build basic web and basic command-line applications
Work securely with files on a machine, both encrypted and in plain text
Author(s): Eric Mann
Edition: 8
Publisher: O'Reilly Media, Inc.
Year: 2023
Language: English
Commentary: 8th Early Release
Pages: 498