3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array( 'bar' => '', 'foo' => 'o', 'foobar' => '', 'hello' => 'hello' ); foreach ($tests as $input => $expected) { if ($expected !== ($actual = strtr($input, array("fo" => "", "foobar" => "", "bar" => "")))) { echo "KO `$input` became `$actual` instead of `$expected`\n"; } else { echo "OK `$input` became `$expected`\n"; } }

preferences:
57.3 ms | 402 KiB | 5 Q