Looking for an alternative to the range() function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
trantron
Forum Newbie
Posts: 5
Joined: Thu Feb 12, 2004 10:36 am

Looking for an alternative to the range() function

Post by trantron »

Looking for an alternative to the range() function

It is not working on an older version of PHP that I am stuck using.

According to the PHP manual:

Note: Prior to PHP version 4.1.0, range() only generated incrementing integer arrays. Support for character sequences and decrementing arrays was added in 4.1.0. Character sequence values are limited to a length of one. If a length greater than one is entered, only the first character is used.

If you know of a way of getting the same result as this function, I would really appreciate your help.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Could you explain what kind of range you are looking for - it would make it easier to come up with a solution for your problem.

Mac
trantron
Forum Newbie
Posts: 5
Joined: Thu Feb 12, 2004 10:36 am

Post by trantron »

I need to replace

range($min, $max);

for exmple: 1980-1984
$min= 1980
$max=1984

should return : 1980, 1981,1982,1983,1984
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

hm... to me it seems like 'incrementing integer array'.....
Post Reply