Result: DiscardedThe test labeled "Casting" was the faster by 0.0652 seconds, (5.574% faster)
The Casting test took 1.1039 seconds.
The is_float test took 1.1691 seconds.
Each test case ran 20 random code order iterations consisting of 272,445 loops for a total of 5,448,900 runs.
- Line execution difference (0.000012) milliseconds.
- Avg difference (3.258) milliseconds per 272,445 loops.
- Total difference 65.16 milliseconds for 5,448,900 loops
The iteration variablity for Code 1 was (8.3088) milliseconds and Code 2 was (5.8478) milliseconds. The lower and the closer together there values are the more accurate the results are.
The first test, "is_float", was:
$a = is_float($GLOBALS['test']);
The second test, "Casting", was:
$a = (float) $GLOBALS['test'] === $GLOBALS['test'];