3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $scrambled_word = "rerimafa;eorzdsntictaimoa;sgiytihe;rleadf;opflpy;imtadx;ynivdiit;owdes;etylvroc;rasomr"; function asciiSum($word) { $characters = str_split(strtolower($word)); $sum = 0; foreach($characters as $character) { $sum += ord($character); } return $sum; } function alphWord($word) { $alphWord = str_split($word); sort($alphWord); $alphWord = implode('', $alphWord); return $alphWord; } $scrambled_word = explode(";", $scrambled_word); $words = explode("\n", file_get_contents('dictionary.txt')); $password = ''; for ($x = 0; $x <= 9; $x++) { foreach ($words as $word) { if (strlen($scrambled_word[$x]) === strlen($word)) { // Same lenght? if(asciiSum($scrambled_word[$x]) == asciiSum($word)) { // Same ascii score? if(alphWord($scrambled_word[$x]) == alphWord($word)) { // Same word after alph order? $password .= $word.';'; break; } } } } } echo substr($password, 0, -1); ?>
Output for 4.3.2 - 7.2.0
Warning: file_get_contents(dictionary.txt): failed to open stream: No such file or directory in /in/B85Nk on line 22
Output for 4.3.0 - 4.3.1
Warning: file_get_contents(dictionary.txt) [http://www.php.net/function.file-get-contents]: failed to create stream: No such file or directory in /in/B85Nk on line 22