PHP
The server-side language of the web
Learn PHP from scratch: from how a script runs on the server, variables and strings to conditions, loops, arrays and functions, and on to classes, interfaces, traits, enums and exceptions. Then you will master forms, sessions, security and working with databases through PDO. At the end of the course you will build a guestbook with PDO and SQLite and be ready to move on to Laravel.
Course content
PHP basics
BeginnerRun a PHP script and get to know variables, types, strings, operators, conditions and loops.
- 1What is PHP? Your first scriptLearn how PHP works on the server, run a script in the terminal and in the built-in web server, and write your first program with echo and print.13 min
- 2Variables, types and stringsCreate variables, inspect PHP's basic types with var_dump, put variables inside strings, write heredocs and use handy string functions.15 min
- 3Operators, conditions and loopsLearn arithmetic and comparison operators, understand == versus === and type juggling, and teach your program to decide with if, match and loops.17 min
Arrays and functions
BeginnerStore data in arrays, walk through it with foreach, and split code into typed functions, arrow functions and closures.
- 4Arrays and foreachCreate indexed, associative and multidimensional arrays, walk through them with foreach, sort them, and learn to destructure and combine arrays.16 min
- 5Functions, arrow functions and closuresWrite functions with typed parameters and return types, use default and named arguments, arrow functions and closures, and process arrays with array_map, array_filter and usort.18 min
Object-oriented PHP
IntermediateBuild classes, inheritance, interfaces, traits and enums, organise code with namespaces and Composer, and handle errors with exceptions.
- 6Classes and objectsCreate classes, use constructor promotion and readonly properties, and learn static members and inheritance.18 min
- 7Interfaces, traits, enums and ComposerBuild contracts with interfaces and abstract classes, reuse code with traits, describe fixed sets of values with enums, and organise a project with namespaces and Composer.20 min
- 8Exceptions and error handlingCatch errors with try/catch/finally, understand the Exception and Error hierarchy, create your own exception class and set up error reporting correctly for development and production.17 min
The web and databases
AdvancedHandle forms, sessions and cookies securely, connect to a database with PDO and build the final project.
- 9Forms, sessions and securityReceive form data with $_GET and $_POST, validate it and protect against XSS with htmlspecialchars, work with sessions and cookies, upload files, hash passwords and apply CSRF tokens.22 min
- 10Databases with PDO and a guestbook projectConnect to MySQL and SQLite with PDO, prevent SQL injection with prepared statements, perform CRUD operations, build a guestbook and see how Laravel does the same job.25 min