$text = '0000000000000000000000';
$arrSign = [
1,2,3,4,5,6,7,8,9,0
];
$ind = rand(1, 3);
$i = 0;
echo $text;
while ($i < strlen($text)) {
$sign = rand(1, 10);
$str = $str.substr($text, $i, $i+$ind).$arrSign[$sign];
++$i;
}
echo '<br />'.$str;
function splitter($subject, $n, array $symbols) {
return implode(array_map(function ($part) use ($n, $symbols) {
if (strlen($part) === $n) {
$part .= $symbols[array_rand($symbols)];
}
return $part;
}, str_split($subject, $n)));
}
echo splitter('0000000000000000000000', rand(1, 3), [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);