A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 50 companion flashcards using spaced repetition.
At the heart of modern PHP is its object-oriented programming model. A class is a blueprint that defines the properties (variables) and methods (functions) its objects will have. Y...
PHP supports inheritance through the extends keyword, which lets a child class reuse and extend the behavior of a parent class. The child inherits all public and protected properti...
As PHP projects grow, name collisions become inevitable: two libraries may both define a class called User or Logger. Namespaces solve this by acting as virtual directories for you...
Since PHP 7, type declarations have become a cornerstone of robust PHP code. Type hints let you declare the expected types of function parameters and return values, enabling PHP's...
PHP's array is a versatile ordered map that doubles as a list, and the language provides many built-in functions for transforming and querying them. array_map() applies a callback...
For database access, PHP Data Objects (PDO) provides a uniform layer across multiple database engines. You connect by instantiating PDO with a Data Source Name that encodes the dri...
Closures are anonymous functions that you can assign to variables, pass as arguments, or return from other functions. A regular closure captures variables from its enclosing scope...