NYCPHP Meetup

NYPHP.org

[nycphp-talk] foreach ERROR

CED Consult at CovenantEDesign.com
Mon Jul 17 15:43:29 EDT 2006


Sirs,

I have used variables many times in foreach statements... and having spent several hours tryignt o debug this I thought I'd throw it out here:

  1.. <? 
  2.. function readD($dir){ 
  3.. if(!$dir){$dir = '.';} 
  4.. foreach(glob("$dir/*.mp3") as $item){$sort[]= end(explode('/',$item));} 
  5..  foreach($sort as $sorteditem){ 
  6..   if($sort){natsort($sort);} 
  7..     foreach($sort as $item){$return[]= $item;} 
  8..      if(!$return){return array();} 
  9..      } 
  10..   return $return; 
  11..   } ?> 
  12.. <?php header("Content-type: text/xyxml") ?> 
  13.. <? echo(' <?xml version="1.0" encoding="UTF-8"?> ') ; ?> 
  14.. <? echo '<player showDisplay="yes" showPlaylist="no" autoStart="yes"> 
  15.. ' ; 
  16..  
  17.. $sFolder = '../Audio/Music' ; 
  18.. foreach(readD($sFolder) as $item) 
  19.. {
PHP keeps erroring on Lines 5 and 18. Any thoughts? Is this a bug? Am I a moron?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060717/47ca6945/attachment.html>


More information about the talk mailing list