Yngvarr

Generation

generate functionMon, 17 Apr 2023

после каждой цифры вставить случайную букву

function afterEachNumber ($str) { $str = str_split($str); $result = ""; $letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; for ($i = 0; $i < count($str); $i++) { $result .= $str[$i]; if (is_numeric($str[$i])) { $result .= $letters[rand(0, 25)]; } } return $result; }

Questions about programming?Chat with your personal AI assistant