Foreach changed from php 4 to 5?

design

#1

I have the following chunk of code which seems to work fine on 4 and throws warnings under 5…

foreach($indexR as $key => $value){ ## goes thru the search
list($siteIndexTitle) = getPageTitle($value); ## get page titles and href
foreach($siteIndexTitle as $kk => $vv){ ## this is line 39
$dirListingArray[$kk] = $vv; }
}

php 4 site:
byosmosis.com/sitemap.html

php5 site:
samba.byosmosis.com/sitemap.html

php5 errors:
Warning: Invalid argument supplied for foreach() in /home/.fiery/byosmosis2/samba.byosmosis.com/sitemap.php on line 39

Warning: Invalid argument supplied for foreach() in /home/.fiery/byosmosis2/samba.byosmosis.com/sitemap.php on line 39

Warning: Invalid argument supplied for foreach() in /home/.fiery/byosmosis2/samba.byosmosis.com/sitemap.php on line 39

Any ideas about what might be going wrong? My first thought was there was a difference in the treatment of “nested foreachs” between the versions, also I thought maybe there was something in the local env of the 5 server that constituted an “invalid argument” being passed into the array. But I don’t see anything unique from one env to the other really.

Any help appreciated,

ByOsmosis


#2

There is no change in the way foreach() works. The error messages you are getting suggest that $indexR and $siteIndexTitle are not valid associative arrays.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]