Result: DiscardedThe test labeled "is_float" was the faster by 0.0015 seconds, (0.260% faster)
The is_float test took 0.5721 seconds.
The Casting test took 0.5736 seconds.
Each test case ran 20 random code order iterations consisting of 133,163 loops for a total of 2,663,260 runs.
- Line execution difference (0.000001) milliseconds.
- Avg difference (0.075) milliseconds per 133,163 loops.
- Total difference 1.49 milliseconds for 2,663,260 loops
The iteration variablity for Code 1 was (4.1245) milliseconds and Code 2 was (4.4923) milliseconds. The lower and the closer together there values are the more accurate the results are.
The first test, "is_float", was:
$a = is_string($GLOBALS['test']);
The second test, "Casting", was:
$a = (string) $GLOBALS['test'] === $GLOBALS['test'];