<?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'));
<?php include '../src/unreal4u/debugInfo.class.php'; throwExceptions(); $debugInfo = new unreal4u\debugInfo('beginScript'); printf('The exact timestamp at which this script started is %.4f (%s) and we are using %s of memory', getExactTime(), $debugInfo::convertTimestamp(getExactTime()), $debugInfo->getMemoryUsage('kib', true)); ob_start(); function a() { trigger_error("If you type google... into google... ", E_USER_ERROR); } function b() { throw new Exception('You can break the internet!'); } 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;
/** * Implements debugInfo::getExactTime as a function * * @see debugInfo::getExactTime * @return float */ function getExactTime() { return unreal4u\debugInfo::getExactTime(); }