Warning: Division by zero in /var/customers/webs/stc/benchmark/index.php on line 256 Test: strpos/strtolower vs. stripos

PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: strpos()/strtolower() vs. stripos()

Run Again Test Menu

Result

Unfortunately, no history for this test is available.

Code

The first test, "strpos()/strtolower()", was:

for ($j = 0; $j < 40; $j++)
	$GLOBALS['dummy'] = strpos(strtolower($GLOBALS['dummy_match']), '9abcd') === 5;
for ($j = 0; $j < 40; $j++)
	$GLOBALS['dummy'] = strpos(strtolower($GLOBALS['dummy_fail']), '9abcd') === 5;

The second test, "stripos()", was:

for ($j = 0; $j < 40; $j++)
	$GLOBALS['dummy'] = stripos($GLOBALS['dummy_match'], '9abcd') === 5;
for ($j = 0; $j < 40; $j++)
	$GLOBALS['dummy'] = stripos($GLOBALS['dummy_fail'], '9abcd') === 5;

Running: Linux (x86_64:1 GB) PHP (7.2.22-1+ubuntu16.04.1+deb.sury.org+1)