3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $tst = '!!!!'; $a = '@@@'; $template = '{{$tst}}test{{$a}}'; if (preg_match_all("/{{(.*?)}}/", $template, $m)) { foreach ($m[1] as $i => $varname) { echo $varname.PHP_EOL; $template = str_replace($m[0][$i], sprintf('$%s', $varname), $template); } } echo $template;
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.1.0
$tst $a $$tsttest$$a
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ann3v on line 9 $tstPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ann3v on line 9 $aPHP_EOL$$tsttest$$a