try { a(); } catch (Exception $e) { debug('Captured exception 1: "' . $e->getMessage() . '"'); try { b(); } catch (Exception $e) { debug('Captured exception 2: "' . $e->getMessage() . '"'); } } $array = array(null, false, true, 1, 3.1415, 'hello', ''); foreach ($array as $value) { debug($value, true, 'VALUE:: '); $debugString = debug($value, false, 'VAL:: '); unreal4u\debugInfo::debugFirePHP($value); print $debugString; } $nestedArray = $array; $nestedArray['more'] = $array; $nestedArray['more']['more'] = $array; debug($array); debug($nestedArray); $writtenToFile = debugFile($array, '', '/tmp/'); debug($writtenToFile, true, 'Written to file: '); print $debugInfo; unreal4u\debugInfo::debugFirePHP($array); $debugInfo->endCounter('beginScript'); printf('Terminating the script... Total time: '); debug($debugInfo->getDiff('beginScript', 'all')); printf('The exact timestamp at which this script ended is %.4f (%s) and we are using %s of memory', getExactTime(), $debugInfo::convertTimestamp(getExactTime()), $debugInfo->getMemoryUsage('kib', true)); ob_end_flush();
<?php include '../src/unreal4u/debugInfo.class.php'; function myProcess() { for ($i = 0; $i < 200000; $i++) { $j = round($i * 44 + 33 * $i - $i * sqrt(10), 6); } return true; } $benchmark = new unreal4u\debugInfo('bigProcess'); myProcess(); printf('Total time spent in %s: %.6f', 'bigProcess', $benchmark->endCounter('bigProcess', 'time'));