explode() question Does this work on all versions of PHP ...
Posted: Thu Feb 12, 2004 10:36 am
I am running this code on version 4.3.4
This code takes a range of years e.g. 1980-85 and inserts into the database 80,81,82,83,84,85
$yr=explode("-", $years);
if($yr)
{
$left=substr($yr[0],-2);
$right=substr($yr[1],-2);
$var=range("$left","$right");
for($i=0; $i < $right; $i++)
$years=implode(",", $var);
}//end if
I then use the variable $years in a database.
The code works perfect on version 4.3.4 but when I run it on version 4.2.1 it does not work
I only get a singe digit. In this case it would just be an 8
Does anybody know why??
Thanks
This code takes a range of years e.g. 1980-85 and inserts into the database 80,81,82,83,84,85
$yr=explode("-", $years);
if($yr)
{
$left=substr($yr[0],-2);
$right=substr($yr[1],-2);
$var=range("$left","$right");
for($i=0; $i < $right; $i++)
$years=implode(",", $var);
}//end if
I then use the variable $years in a database.
The code works perfect on version 4.3.4 but when I run it on version 4.2.1 it does not work
I only get a singe digit. In this case it would just be an 8
Does anybody know why??
Thanks