3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text1 = 'I wanna match pattern 1 which is very different from pattern 2'; $text2 = 'I wanna match pattern 2, again nothing similar with pattern 1 here'; $regex = '/(?J)I wanna match pattern (?<number>1) which is very different from pattern 2|(?<number>2), again nothing similar with pattern 1 here/'; echo "Pattern 1\n"; preg_match_all( $regex, $text1, $matches ); var_dump($matches['number'][0]); echo "\n\nPattern 2\n"; preg_match_all( $regex, $text2, $matches ); var_dump($matches['number'][0]);
Output for git.master, git.master_jit, rfc.property-hooks
Pattern 1 string(0) "" Pattern 2 string(1) "2"

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:
29.43 ms | 405 KiB | 5 Q