PHP programming exercises.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Learn PHP by fixing failing tests. Designed as a series of successive problems where you type missing pieces of code to learn the basics all the way to advanced concepts with PHP. When you're finished you'll also have an entire library of code samples to reference as well.

Designed to teach the basics of PHP and inspired by the absolutely awesome Requires PHP 5.3 or greater.


  • Install PHP 5.3 or higher and the ability to run the php command from the command line.
  • Install Composer from

Getting Started

  1. Checkout or fork this repository and make sure you're on the master branch.
  2. Open up a terminal run composer install from the checked out project to install dependencies.
  3. Run php koans.php from a terminal and follow the instructions. Re run this command as you solve the problems to see your progress.


##Chapter 1 - Variables

  1. Declaration - [S]
  2. Integers - [S]
  3. Floats - [S]
  4. Booleans - [S]
  5. Null - [S]
  6. Casting - [S]
  7. Assignment - [S]
  8. Constants - [S]

##Chapter 2 - Math

  1. Addition - [S]
  2. Subtraction - [S]
  3. Multiplication - [S]
  4. Division - [S]
  5. Modulus - [S]
  6. Rounding Naturally - [S]
  7. Rounding Up and Down - [S]
  8. Increment and Decrement - [S]

##Chapter 3 - Strings

  1. Concatenation - [S]
  2. Substitution - [S]
  3. Replacement - [S]
  4. Length - [S]
  5. Single Characters - [S]
  6. Substrings - [S]
  7. Changing Case - [S]
  8. Searching - [S]

#Status I'm building this out as a side project when I have time so the exercises don't cover all of the concepts they should yet, but everything in the master branch will always be complete. If you get stuck you can also check the solutions branch to see the pieces of missing code to fix the problems.

#Feedback If you found these helpful, spot a bug, or want to help contribute please contact me.