© 2026 Dometrain. All rights reserved.
Learn how to write PHP, from basic syntax and arrays to object-oriented programming and database access.
Modern PHP is a strictly typed, fully featured object-oriented language, and writing it effectively requires a deep understanding of its core mechanics. This course builds a comprehensive mental model of PHP from the ground up, starting with types, coercion, and the exact differences between == and ===. You will manipulate text using heredoc syntax and sprintf, handle rounding and math operations, and direct control flow using the match expression, the spaceship operator <=>, and null coalescing with ?? and ??=. From there, you will master arrays as both ordered lists and associative maps, leveraging tools like array_map, array_slice, and array_splice. Building on these structures, you will write functions with strict type declarations, named arguments, and variadics, before exploring closures, arrow functions, and how state is shared using the use keyword and reference semantics.
The second half of the course focuses heavily on modern object-oriented design and practical application architecture. You will build robust domain models using classes and constructor property promotion, and enforce encapsulation using property hooks. We examine class hierarchies and composition through inheritance, interfaces, abstract classes, and traits, as well as how to model state with pure and backed enums. You will also learn to handle failure states gracefully by understanding the separate Error and Exception trees, and how to utilize magic methods for dynamic behavior. Moving beyond language syntax, the course covers real-world mechanics: managing dates and timezones, parsing JSON and CSV files, pattern matching with regular expressions, and handling memory-efficient iteration with generators and the yield keyword. Finally, you will interact with databases using PDO and SQLite, managing statements and transactions, before tying everything together with data validation, namespaces, and comprehensive capstone projects like a JSON-based lending API and a transactional bookstore inventory system.