Follow:  Follow PHPExercises on Twitter  Follow us on Facebook

Beginner to Intermediate PHP Exercises

Exercises, not Tutorials

The Web is full of excellent PHP tutorials. PHP exercises? Not so much, although more now than when this site first launched. Choose one from the menu on the left (or down below if you're on mobile), and get started!

How It Works

Come here to test your PHP knowledge by writing scripts as requested. When you are ready, click the button to see the PHP answer script. The answer script output is also available. If you need tutorials, check out one of the PHP tutorial sites listed on the Resources page, then come back and try out what you learned!

The PHP programming exercises progress from the simplest scripts ("Hello world!") to more complex. More difficult requests build on skills included in earlier ones. If you jump ahead and find yourself stuck, go back one or two. Be sure to read the comments in the answer script for some explanation. If you find that a different approach gets the same results, great! Just be sure you understand the PHP syntax the problem was designed to test.

What You'll Need

We assume that if you are looking for PHP exercises, you already have a server to practice with. If not, check out Your Setup for some tips on getting started.