Skip to content

Instantly share code, notes, and snippets.

@boonebgorges
Created October 26, 2016 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boonebgorges/a4f40af56d3e9263575daee5cd6d4c3c to your computer and use it in GitHub Desktop.
Save boonebgorges/a4f40af56d3e9263575daee5cd6d4c3c to your computer and use it in GitHub Desktop.
<?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