3v4l.org

run code in 300+ PHP versions simultaneously
<?php function startsWith($haystack, $needle) { return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE; } function find_dec_prefix($str) { $i = 0; for(;;$i++) { $newstr = $str . $i; $hash = sha1($newstr); if($hash[0] == '0' && $hash[1] == 'e') { // echo "Found it: [" . $newstr . "] " . $hash . "\n"; // echo "subs: " . substr($hash, 2) . "\n"; if(!preg_match("/[a-f]/", substr($hash, 2))) { echo "doesn't contain a-f: $hash\n"; return $newstr; } } } } $pass1 = find_dec_prefix("suPERSecretPasSw0rD"); $pass2 = find_dec_prefix("omgDONTcollidePLEASE"); var_dump(sha1($pass1) == sha1($pass2)); echo(sha1('aaroZmOk') . " - " . sha1('aaK1STfY') . "\n");
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6

Process exited with code 137.

preferences:
171.95 ms | 404 KiB | 229 Q