3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hello = 'Hi'; $name = 'ken'; $replacements = [ 'hello' => 'morning', 'invoiceno' => 1234 ]; $msg = '$hello, $name (JX02), Your Orders $invoiceno has been delivered. $test $123,99 $123.99 Thank you.'; $result = preg_replace_callback('/\$([\w\_-]{1,})/', function ($match) use ($replacements) { return array_key_exists($match[1], $replacements) ? $replacements[$match[1]] : ( isset($GLOBALS[$match[1]]) ? $GLOBALS[$match[1]] : '$'.$match[1] ); }, $msg); echo $result;
Output for git.master, git.master_jit, rfc.property-hooks
morning, ken (JX02), Your Orders 1234 has been delivered. $test $123,99 $123.99 Thank you.

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