PHP exercises with solutions

45 practice problems from the 15 lessons of the PHP Programming course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

Your first PHP program

3 problems · Read the lesson

Variables and types

3 problems · Read the lesson

Strings

3 problems · Read the lesson

Input from STDIN

3 problems · Read the lesson

Operators and conditions

3 problems · Read the lesson

Loops

3 problems · Read the lesson

Arrays

3 problems · Read the lesson

Associative arrays

3 problems · Read the lesson

Functions

3 problems · Read the lesson

Scope and closures

3 problems · Read the lesson

String and array functions

3 problems · Read the lesson

Classes and objects

3 problems · Read the lesson

Inheritance, interfaces and traits

3 problems · Read the lesson

Exceptions

3 problems · Read the lesson

Putting it together

3 problems · Read the lesson