3v4l.org

run code in 300+ PHP versions simultaneously
<?php //(?=) - positive lookahead $string = "achei quebra; tem aqui;"; $regex = "/\w+(?=;)/"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?!) - negative lookahead / $regex = "/\b\w+\b(?!;)/"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?<=) - positive lookbehind $string = "dra Julia \ndr Marcos \ndr Mateus \ndra Ana"; $regex = "/(?<=dra\s)(\w+)/im"; preg_match_all($regex, $string, $matches); var_dump($matches); //(?<!) - negative lookbehind $regex = "/(?<!^dra\s)\b\w+\b$/im"; preg_match_all($regex, $string, $matches); var_dump($matches); /* (?>) - atomic group */
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { [0]=> array(2) { [0]=> string(6) "quebra" [1]=> string(4) "aqui" } } array(1) { [0]=> array(2) { [0]=> string(5) "achei" [1]=> string(3) "tem" } } array(2) { [0]=> array(2) { [0]=> string(5) "Julia" [1]=> string(3) "Ana" } [1]=> array(2) { [0]=> string(5) "Julia" [1]=> string(3) "Ana" } } array(1) { [0]=> array(0) { } }

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:
160.51 ms | 406 KiB | 5 Q