3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'The ID is \$ID and name is \$name'; $row = [ 'ID'=> 5, 'name' => 'delboy1978uk', ]; function replaceStuff($string, $row) { preg_match_all('#\\$\w+#', $string, $matches); foreach ($matches[0] as $match) { $key = str_replace('$', '', $match); $replace = '\\'.$match; $string = str_replace($replace, $row[$key], $string); } return $string; } echo replaceStuff($string, $row);
Output for rfc.property-hooks, git.master, git.master_jit
The ID is 5 and name is delboy1978uk

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:
42.55 ms | 1700 KiB | 4 Q