Created
September 26, 2025 03:36
-
-
Save jpalala/34a4b285a65b3ed4ab62b1e2e3409396 to your computer and use it in GitHub Desktop.
leet password generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function leetTransform($word) { | |
| $result = ""; | |
| $vowels = ['a', 'i', 'o', 'u']; | |
| foreach (str_split($word) as $c) { | |
| if ($c === '-') { | |
| $result .= '-'; // keep dash as-is | |
| } elseif (strtolower($c) === 'e') { | |
| $result .= '3'; | |
| } elseif (in_array(strtolower($c), $vowels)) { | |
| $result .= strtolower($c); // vowels stay lowercase | |
| } else { | |
| $result .= strtoupper($c); // consonants -> uppercase | |
| } | |
| } | |
| return $result; | |
| } | |
| $words = ["dreamed", "big", "stumbled", "often", "never", "stopped"]; | |
| // Apply randomCase to each word | |
| $randomized = array_map("leetTransform", $words); | |
| // Join them back with dashes | |
| $passphrase = implode("-", $randomized); | |
| $passphrase .= '!!'; | |
| echo $passphrase . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment