Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function foo( $r ) {
if ( 0 ) {
$r = 1;
}
return $r;
}
$time = microtime();
for ( $n = 0; $n < 10000; $n++ ) {
$foo = call_user_func_array( 'foo', array( 'foo' ) );
}
$time_diff = microtime() - $time;
var_dump( 'with' );
var_dump( 'Time diff: ' . $time_diff );
$time = microtime();
for ( $n = 0; $n < 10000; $n++ ) {
$foo = 'foo';
}
$time_diff = microtime() - $time;
var_dump( 'without' );
var_dump( 'Time diff: ' . $time_diff );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment