The
array_fill() array function in PHP will create an array structured according to the parameter values you use in it. It takes three parameters. The first parameter is the index number that you want your array to start with. The second parameter is how many elements you wish the array to have. The third parameter is the filler value that all of the array elements will have.
<?php
$index = 1;
$amount = 7;
$filler = "poop";
$newArray = array_fill($index, $amount, $filler);
foreach ($newArray as $key => $value) {
echo "Index $key - <strong>$value</strong> <br />";
}
?>
Index 1 - poop
Index 2 - poop
Index 3 - poop
Index 4 - poop
Index 5 - poop
Index 6 - poop
Index 7 - poop