I want to make an array with the same value and set the array to be maximum based on my counter.
For example, I want to create an array with a string "hello" and I want it to keep going until the number of array is 3.
How is that possible using php with yii2 framework?
you can use a for loop this way
$array= array();
for($i=0;$i<3;$i++){
$array[] = "hello";
}
You will get $array with 3 hello.
try array_fill
$count = 5;
$a = array_fill(0, $count, 'hello');