- str_split: documentation ( source)
<?php
function createCombinations($input, $length) {
foreach($input as $c) {
if($length == 1) {
return $c;
}
else {
foreach(createCombinations($input, $length -1) as $s) {
return $c + $s;
}
}
}
}
$texte = "abcdefghijklmnopqrstuvwxyz0123456789";
$input = str_split($texte );
echo createCombinations($input, 4);