The web's workhorse
PHP
PHP is a server-side language that powers a large share of the web, from WordPress and Laravel applications to plain templated sites and JSON APIs, and it runs anywhere a web host does. This curriculum starts with the syntax, types, loops, functions and arrays you need for any script, moves on to strings, associative arrays, sorting and classes, and finishes with exceptions and JSON handling, the two skills every real PHP backend depends on. Every example is verified against PHP 8.4, and every exercise reads standard input and prints to standard output, so what you write here works unchanged on the command line.
- lessons
- 9 lessons
- exercises
- 14 exercises
- interview questions
- 12 interview questions
What PHP is used for
- Web backends
- Content management systems
- E-commerce
- APIs
How examples are checked
Every example and every exercise solution was run with PHP 8.4 at build time. In-browser execution for PHP is not available yet; the pages say so rather than pretending.
Learn
The PHP learning path
Read in order: each lesson leans only on the ones before it. Every lesson ends with a small program to write and links to matching exercises.
Beginner
BeginnerIntermediate
IntermediateAdvanced
AdvancedPractice
Practise PHP
14 exercises across 10 topics, each checked by running your program against test cases. Start with these:
- Ferry fare totalEasy
Compute the total cost of ferry tickets for adults and children in PHP and print it with two decimal places using sprintf.
BasicsNot started
- Initials from a full nameEasy
Read a full name and print its initials in uppercase. Practise explode, string indexing and strtoupper in PHP.
StringsNot started
- Dose checker with exceptionsMedium
Validate pharmacy input with InvalidArgumentException in PHP, catch it per line, and keep processing after each error.
ExceptionsNot started
- Fun run results tableMedium
Sort race finishers by time and then by name with usort and the spaceship operator, and print a ranked results table in PHP.
SortingNot started
More