PHP for Beginners
Learn PHP from your first script to handling real form data safely.
- Beginner
- 13 lessons
- 8 hours
Learn PHP from your first script to handling real form data safely.
Indexed and associative arrays, nested arrays, adding and removing items, and the array functions you will use every day.
Define functions with parameters, defaults and return types, understand scope, and use named arguments, arrow functions and closures.
Learn while, do-while, for and foreach loops in PHP, when to use each one, and how to avoid infinite loops.
Build a contact form handler in PHP that validates input, keeps the user’s answers, escapes output, and redirects after a successful POST.
Use include, require and their _once variants, build paths with __DIR__, share templates and configuration, and keep private files out of the web root.
Understand PHP’s error types, configure error display for development and production, use try/catch with exceptions, and debug with var_dump and logs.
PHP is a server-side language that builds web pages before they reach the browser. Learn how it works and where it fits.
Learn how to create variables, the main PHP data types, how type juggling works, and how to switch on strict types.
Get PHP 8 running on your computer, check the version, and run scripts from the terminal and PHP’s built-in web server.
Learn PHP tags, statements and semicolons, comments, echo and print, and how PHP mixes with HTML.
Arithmetic, assignment, comparison, logical and null coalescing operators in PHP, with the comparison traps to avoid.
Single versus double quotes, interpolation, concatenation, heredoc, and the string functions you will use every day, including mb_ functions for non-English text.
Use if, elseif and else, understand truthy and falsy values, and pick between switch and PHP 8’s match expression.