3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); @ini_set('display_errors', 0); if (!function_exists('shutdown')) { function shutdown() { $isError = false; if ($error = error_get_last()){ switch($error['type']){ case E_ERROR: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: $isError = true; break; } } if ($isError){ echo preg_replace('/(<\?php)(.*?)(\?>)/ims','',$GLOBALS['html']); // Run even next lines!!! //eval(str_replace('eval(','//eval(',file_get_contents(__FILE__))); return true; } } } register_shutdown_function('shutdown'); $html='Hi it is <b>PAPION</b>. Now timestamp is <?php echo time(); ?>. have a good time. a can be: <?php a=b*2 ?>. and wrong timestamp is <?php xxxxtime(); ?>.'; $html = preg_replace_callback('/(<\?php)(.*?)(\?>)/ims',function($matches){ try { ob_start(); eval($matches[2]); return ob_get_clean(); } catch(Throwable $e) { return ""; } }, $html); echo $html; echo "\n\nwe are here!";
Output for 7.1.31 - 7.1.32, 7.2.21 - 7.2.33, 7.3.8 - 7.3.33, 7.4.4 - 7.4.5, 7.4.7 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Hi it is <b>PAPION</b>. Now timestamp is 1570285858. have a good time. a can be: . and wrong timestamp is . we are here!
Output for 7.4.6
Hi it is <b>PAPION</b>. Now timestamp is 1589866598. have a good time. a can be: . and wrong timestamp is . we are here!
Output for 7.4.0
Hi it is <b>PAPION</b>. Now timestamp is 1575186383. have a good time. a can be: . and wrong timestamp is . we are here!
Output for 7.1.25 - 7.1.30, 7.2.11 - 7.2.20, 7.3.0 - 7.3.7
Hi it is <b>PAPION</b>. Now timestamp is 1570285859. have a good time. a can be: . and wrong timestamp is . we are here!
Output for 7.2.0 - 7.2.10
Hi it is <b>PAPION</b>. Now timestamp is 1570285860. have a good time. a can be: . and wrong timestamp is . we are here!

preferences:
105.97 ms | 411 KiB | 5 Q