Skip to content

Instantly share code, notes, and snippets.

@nunoveloso
nunoveloso / gist:2376130
Created April 13, 2012 11:37
PHP execution time
/** stopwatch php script execution time **/
$ts = microtime(true);
// do shit here
printf("%.4f\n", microtime(true) - $ts);
@nunoveloso
nunoveloso / nuno_php_array_ops.php
Created March 7, 2012 12:34
PHP array operations up to 10x faster than the original
/**
* Home mande method to do array_diff ~10x faster that PHP built-in.
*
* @param The array to compare from
* @param An array to compare against
*
* @return an array containing all the entries from array1 that are not present in array2.
*/
function nuno_array_diff($array1, $array2) {
$diff = array();