Result: DiscardedThe test labeled "Casting" was the faster by 0.0087 seconds, (0.760% faster)
The Casting test took 1.1316 seconds.
The is_int test took 1.1403 seconds.
Each test case ran 20 random code order iterations consisting of 277,309 loops for a total of 5,546,180 runs.
- Line execution difference (0.000002) milliseconds.
- Avg difference (0.433) milliseconds per 277,309 loops.
- Total difference 8.67 milliseconds for 5,546,180 loops
The iteration variablity for Code 1 was (6.4730) milliseconds and Code 2 was (7.3666) milliseconds. The lower and the closer together there values are the more accurate the results are.
The first test, "is_int", was:
$a = is_int($GLOBALS['test']);
The second test, "Casting", was:
$a = (int) $GLOBALS['test'] === $GLOBALS['test'];