$text = $_GET["text"] function crack($ciphertext){ $plaintexts = []; foreach (range(0, 25) as $key) { $plaintexts[$key] = substr_count(strtolower($this->decrypt($ciphertext, $key)), 'e'); } return array_search(max($plaintexts), $plaintexts); }