Is it possible to divide a number into an array based on its value?
For example:
$val = 3;
// do something here to convert the number 3 into 1's
Array
(
[0] => 1
[1] => 1
[2] => 1
)
$array = array_fill(0, $val, 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With