I have a php range $first=1; $last=10; foreach(range($first,$last) as $number) {echo $number."\n";} which will display 1 2 3 4 5 6 7 8 9 10 What I am looking for is 1 2 3 4 5 6 7 8 9 Any suggestions on the most efficient way to do this? Also the numbers always change too. It may not be 9 there maybe 20 or 40, or 5. I was thinking somewhere along the lines of a -1 of some sort.
In the foreach loop when you put range at that time you just have to decrease your range end, So you just have to put ($first,($last-1)) Hope it works for you...