3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ciao() { $out = '<pre>'; $args = func_get_args(); if(!empty($args)) { // var_export() causes fatal errors on recursion... ob_start(); ini_set('xdebug.var_display_max_depth', 4); var_dump($args); $out .= ob_get_contents()."\n\n"; ob_end_clean(); } $out .= get_backtrace(1); die($out); } class A { function B() { while (ob_get_level() > 1) ob_end_flush(); // store possible trailing content $content = ob_get_clean(); // start an output buffer which cannot be flushed (3rd parameter is false) // callback function get all output and corrects Content-Length header ob_start(function($buffer) { ciao($buffer); }, 0, false); } } $a = new A; $a->B();

preferences:
45.86 ms | 402 KiB | 5 Q