$text_lenght = 3;
$charset = 'abc';
$results = [];
create_words($text_lenght);
sort($results);
foreach ($results as $i => $result) {
echo ++$i . '. ' . $result . '<br>';
}
function create_words(string $width, int $position = 0, string $base_string = ''): void
{
global $text_lenght, $charset, $results;
for ($i = 0, $j = strlen($charset); $i < $j; ++$i) {
if ($position < $width - 1) {
create_words($width, $position + 1, $base_string . $charset[$i]);
}
if (strlen($base_string . $charset[$i]) <= $text_lenght) {
$results[] = $base_string . $charset[$i];
}
}
}
<?
$alphabet = 'abc';
$length = 3;
$words = array();
function makeword($prefix)
{
global $alphabet, $length, $words;
if (strlen($prefix) == $length)
{
$words[] = $prefix;
return;
}
for ($i = 0; $i < strlen($alphabet); $i++)
makeword($prefix . $alphabet{$i});
}
makeword('');
foreach($words as $value)
{
echo $value, "<br>";
}
?>
--enable-kiosk-mode --kiosk --user-data-dir=C:\Temp\ChromeTemp --window-size=1000,1030 --window-position=-3,-77 http://google.ru