PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $substring = "foobar"; $string = str_repeat($substring, 100); $count = 1; $time = microtime(true); for ($i=0; $i < $count; $i++) { echo str_starts_with($string, $substring); } #echo round(microtime(true) - $time, 4); $time = microtime(true); for ($i=0; $i < $count; $i++) { echo preg_match("!^$substring!", $string); } #echo round(microtime(true) - $time, 4);
Show:  
Copy Clear