3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ( array( array('/\\d+/', '$0'), array('/\\d+/', '$01'), array('/\\d+/', '$001'), array('/\\d+/', '${0}1'), array('/(\\d+)/', '$0'), array('/(\\d+)/', '$01'), array('/(\\d+)/', '{$0}1'), array('/(\\d+)/', '$1'), array('/(\\d+)/', '$12'), array('/(\\d+)/', '$012'), array('/(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\\d+)/', '$12'), array('/(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\\d+)/', '$123'), ) as $list ) { list ($re, $replace) = $list; echo "$re '$replace' => '", preg_replace($re, $replace, "42"), "'\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
/\d+/ '$0' => '42' /\d+/ '$01' => '' /\d+/ '$001' => '421' /\d+/ '${0}1' => '421' /(\d+)/ '$0' => '42' /(\d+)/ '$01' => '42' /(\d+)/ '{$0}1' => '{42}1' /(\d+)/ '$1' => '42' /(\d+)/ '$12' => '' /(\d+)/ '$012' => '422' /(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\d+)/ '$12' => '42' /(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(^)(\d+)/ '$123' => '423'

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:
100.15 ms | 402 KiB | 8 Q