• 24-11-2010, 22:35:18
    #1
    aşagıdaki gibi kod var. 5. ye geldiginde foreach i nasıl durdurabilirim?

    $xml = simplexml_load_file('rss.xml');
    
    foreach($xml->channel->item as $item)
    {
        echo $item->title.' - '.$item->description.' - '.$item->image.'<br>';
     }
  • 24-11-2010, 22:45:05
    #2
    $xml = simplexml_load_file('rss.xml');
    $say = 1;
    foreach($xml->channel->item as $item)
    {
        if($say<=5){
             echo $item->title.' - '.$item->description.' - '.$item->image.'<br>';
             $say++;
        }else{
             //5e kadardı
        }  
    }