3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random($car) { $string = ""; $chaine = "abcdefghijklmnpqrstuvwxy"; srand((double)microtime()*1000000); for($i=0; $i<$car; $i++) { $string .= $chaine[rand()%strlen($chaine)]; } return $string; } $nombreDeTentative = 0; while(random(4) != "samu") { $nombreDeTentative++; } echo "Le nombre de tentative pour trouver samu est de ".$nombreDeTentative; ?>

preferences:
44.25 ms | 402 KiB | 5 Q