Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Retrieves the context code from where an error/exception was thrown (as long as file/line are provided) and outputs it.
* @param string $file - The file where the error/exception occurred.
* @param string $line - The line where the error/exception occurred.
* @param integer $context - How many lines of context (above AND below) the troublemaker should we grab?
* @return string - String containing the perpetrator + context lines for where the error/exception was thrown.
*/
function getErrorContext($file, $line, $context = 3)
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.212994 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.204549 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.200732 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.207176 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.210159 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.413892 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.419085 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.428959 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.440547 seconds
obsidian@lithion-mint ~/Documents $ php benchmark.php
file - 0.430267 seconds
<?php
/**
*
*===================================================================
*
* Codebite site codebase
*-------------------------------------------------------------------
* @version 1.0.0
* @category Codebite
* @package core
<?php
// Define the location of where we are keeping all relevant files :)
define('FAILNET_ROOT', '/home/obsidian/Code/failnet_dev');
// (relative to the root dir specified) what directories do we want to search in?
$dirs = array(
'',
'Core',
'Cron',
'Event',
<?php
define('FAILNET_VERSION', '3.0.0 DEV');
define('OUTPUT_SILENT', 0);
define('OUTPUT_NORMAL', 1);
define('OUTPUT_DEBUG', 2);
define('OUTPUT_DEBUG_FULL', 3);
define('OUTPUT_RAW', 4);
define('OUTPUT_SPAM', 4); // ;D
<?php
benchmark();
$max_iterations = 36;
$pattern_hashes = array_merge(range(0,9), range('a', 'z'));
$KP = new KeyPatterns();
$i = 0;
do
{
<?php
// --- standard template vars
$buffer = '{ $data } some test data { $test } { $test_var } { $test_var-value }';
<?php
define('FAILNET_VERSION', '3.0.0 DEV');
define('OUTPUT_SILENT', 0);
define('OUTPUT_NORMAL', 1);
define('OUTPUT_DEBUG', 2);
define('OUTPUT_DEBUG_FULL', 3);
define('OUTPUT_RAW', 4);
define('OUTPUT_SPAM', 4); // ;D
<?php
$mode = 'php';
benchmark();
$data = array('some_array' => array('another_array' => array('some_string')));
for($i = 0; $i <= 2000; $i++)
{
if($mode == 'json')
{
json_decode(json_encode($data), true);
}