3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mt($start=null){ if ($start === null) return microtime(true); return number_format(microtime(true)-$start, 4); } $str_100k = str_repeat('a', 102400).str_repeat('b', 1024); $str = $str_100k; $needle = 'bbbbbbbbb'; $start = mt(); for ($i=0; $i<500; $i++) $j = strpos($str, $needle); // strpos $t_strpos = mt($start); #echo "\t".mt($start); $start = mt(); for ($i=0; $i<500; $i++) $j = stripos($str, $needle); // stripos $t_stripos = mt($start); #echo "\t".mt($start); echo number_format($t_stripos/$t_strpos, 1);

preferences:
34.88 ms | 402 KiB | 5 Q