Result: DiscardedThe test labeled "is_float" was the faster by 0.0342 seconds, (2.793% faster)
The is_float test took 1.1911 seconds.
The Casting test took 1.2253 seconds.
Each test case ran 20 random code order iterations consisting of 249,141 loops for a total of 4,982,820 runs.
- Line execution difference (0.000007) milliseconds.
- Avg difference (1.711) milliseconds per 249,141 loops.
- Total difference 34.22 milliseconds for 4,982,820 loops
The iteration variablity for Code 1 was (8.6820) milliseconds and Code 2 was (7.2341) 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'];