3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); // assume ob_level is set to 1 $GLOBALS['test'] = false; // is used too check if output is called before test is set to true function output_check() { if($GLOBALS['test'] === true) return; // this is called before test is set to true, there's no return echo "This will be echoed before 'duck': "; die(); // this will end the execution after echoeing duck echo "This will not be echoed, yet 'duck' will be."; } header_register_callback("output_check"); ob_end_clean(); echo "duck"; $GLOBALS['test'] = true; echo " and ducklings";

preferences:
29.58 ms | 406 KiB | 5 Q