Question: I have generate a 16 digit number and i want to extract one number from every 4 digits of that 16 digit number. For e.g: 1234567892345678. I want to extract 2 from 1234, 7 from 5678, 3 from 9034 & 7 from 5678. Then store it in another variable $a. the extraction will be in a random manner.

Answer: 
You can try this - 

```
$d = '1234567892345678';

$s = str_split($d, 4); // split in 4 digits

$n = array_map(function($x) {
    return substr($x, rand(0, 3), rand(1, 1)); // extract single digit random number
}, $s);

```

`$n` will hold the random numbers.
Here you have a one-liner:

```
$s = $string[rand(0,3)].$string[rand(4,7)].$string[rand(8,11)].$string[rand(12,15)];
echo $s;

```

Another one-liner:

```
for($s='',$i=0;$i<10; $s.=$string[rand($i,$i+=3)]);  
echo $s;

```