3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'derp', 'test', 'othershit' ); $someUnknowableTemplate = "the first var is @VAR0, the third is @VAR2"; echo preg_replace('/@VAR(\d)/e','$arr[\1]',$someUnknowableTemplate);

preferences:
44.68 ms | 402 KiB | 5 Q