duniyadnd
12-31-2002, 05:56 AM
Frustrated to the core right now, been on this part for over a day now. What I'm trying to do is go through a page and pick up all the sections that might say <b> or </b> and return them to an array. However, I can't even get to go through the document properly.
function findSection($data)
{
preg_match_all("<(/?)B>", $data, $links);
while(list($key,$val) = each($links[2]))
{
if(!empty($val))
$match[] = $val;
//echo $match;
}//end while
while(list($key,$val) = each($links[3]))
{
if(!empty($val))
$match[] = $val;
//echo $match;
}//end while
return $match;
}//end findSection
The error that is constantly generated is this:
Warning: Variable passed to each() is not an array or object in /home/footyman/public_html/mining/thisisit.phtml on line 68
Warning: Variable passed to each() is not an array or object in /home/footyman/public_html/mining/thisisit.phtml on line 77
as an infinite loop. The lines that concern the error are where the while loop lines begin.
Any help would be appreciated.
Thanks
Duniyadnd
function findSection($data)
{
preg_match_all("<(/?)B>", $data, $links);
while(list($key,$val) = each($links[2]))
{
if(!empty($val))
$match[] = $val;
//echo $match;
}//end while
while(list($key,$val) = each($links[3]))
{
if(!empty($val))
$match[] = $val;
//echo $match;
}//end while
return $match;
}//end findSection
The error that is constantly generated is this:
Warning: Variable passed to each() is not an array or object in /home/footyman/public_html/mining/thisisit.phtml on line 68
Warning: Variable passed to each() is not an array or object in /home/footyman/public_html/mining/thisisit.phtml on line 77
as an infinite loop. The lines that concern the error are where the while loop lines begin.
Any help would be appreciated.
Thanks
Duniyadnd