3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dumpMatches(string $regex, string $value): void { echo $regex . "\n"; if (preg_match($regex, $value, $matches) !== 1) { echo "no match\n"; } else { var_dump($matches); } echo "\n"; } dumpMatches('~a\Kb~', 'ab'); dumpMatches('~a\Kb~', 'b'); dumpMatches('~(a)\Kb~', 'ab'); dumpMatches('~(a\K)b~', 'ab');
Output for git.master, git.master_jit
~a\Kb~ array(1) { [0]=> string(1) "b" } ~a\Kb~ no match ~(a)\Kb~ array(2) { [0]=> string(1) "b" [1]=> string(1) "a" } ~(a\K)b~ array(2) { [0]=> string(1) "b" [1]=> string(1) "a" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
18.17 ms | 405 KiB | 5 Q