3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * When there's no other way than dying, at least do it nicely. * @param string $message The message to show. * @param string|null $file File where problem occured (leave empty to autodetect). * @param integer $line Line of code causing the issue. */ function kbm_fatal($message, $file='', $line=0){ if(!$file){ $trace = debug_backtrace(); if(isset($trace[1]) && isset($trace[1]['file']))$file = $trace[1]['file']; if(isset($trace[1]) && isset($trace[1]['line']))$line = $trace[1]['line']; $file = $file ? basename($file) : 'unknown'; } header('Content-Type: text/html'); die("<div style='font: bold 12px Consolas; color: #A00; background: #FFF; padding: 3px; margin: 1px;'>FATAL: $message [$file:$line]</div>"); } function test(){ kbm_fatal('cheese'); } test();
Output for 4.3.0 - 7.1.0
<div style='font: bold 12px Consolas; color: #A00; background: #FFF; padding: 3px; margin: 1px;'>FATAL: cheese [poj5R:26]</div>