3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = <<<EOT <?php declare(strict_types=1); namespace %namespace% class %classname% { %attributes% %methods% } EOT; preg_match_all('/\%(?P<name>\w+)\%/', $str, $data); $str = str_replace('%classname%', 'test', $str); var_dump($str);
based on aeW4o
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
string(111) "<?php declare(strict_types=1); namespace %namespace% class test { %attributes% %methods% }"