3v4l.org

run code in 300+ PHP versions simultaneously
<?php $textos[] = 'yuqkdp69yHryACb778mvZsbFegIBU#'; $textos[] = 'yuqk#p69yHryACb778mvZsbFigIBUh'; shuffle($textos); foreach ($textos as $texto) { $fim = []; for ($i = 0; $i < 10000; $i++) { $inicio = microtime(true); tem_simbolo_na_senha($texto); $fim[] = microtime(true) - $inicio; } echo $texto . ' demorou ' . array_sum($fim) / count($fim); echo PHP_EOL; } function tem_simbolo_na_senha($texto) { $texto = str_split($texto); foreach ($texto as $letra) { if ($letra == "#" || $letra == "@" || $letra == "%" || $letra == "&") { return true; } } return false; }

preferences:
37.57 ms | 402 KiB | 5 Q