PHP Koans
Replace blanks in PHPUnit tests and finish small functions to learn PHP
Running php contemplate_koans in the project folder starts a bundled copy of PHPUnit 9.5.25, renamed to fit the theme, and it halts at the first failure: an assertTrue(false) on line 15 of AssertKoans.php. Flip it, run again, and the next koan complains.
Free · No login · Terminal · Beginner

About PHP Koans
The set is small. On 30 November 2026 the repository held three working koan files with 34 tests between them: asserts (7), strings (13) and string manipulation (14), plus an empty TrueAndFalseKoans file. The string files carry the weight, probing where PHP differs from other languages: single against double quotes, heredoc against nowdoc, when interpolation needs curly brackets, and sprintf type specifiers.
The README's Work in Progress section lists the 40 Python Koans topics the author planned to port, from lists and dictionaries to classes, exceptions and regex. Beyond the first few, none has arrived, and the last commit (the move to PHP 8.1) is dated 3 October 2022. Next to Ruby Koans, which this series descends from by way of Python Koans, the PHP set is a short tour of strings rather than a full course.
Questions about PHP Koans
Do I need a web server or framework to use the PHP koans?
Are all the exercises just filling in blanks?
Made this game? Claim it →

Tips and discussion
No tips yet.
Sign in to share a tip.