How can I create an array of numbers easily?
$myarray = array(1,2,3,4,5,6,7);
Or you can do it the easy way, using the range function, which you simply pass the first and last value in the consecutive range. So this is equivalent to the above code:
$myarray = range(1,7);
... and when you want an array containing the numbers 1 to a 1,000 - then you'll be glad you learned about this function!
More arrays PHP Questionswhat is the return value of array_unique()?
How do I count the number of times a value appears in an array?
How can I easily view all members of an array?
How can I display a 2 dimensonal array?
How to get most repeated value in an array?