note 23312 added to control-structures.foreach

From: Date: Mon, 15 Jul 2002 13:26:00 +0000
Subject: note 23312 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-33080@lists.php.net to get a copy of this message
It is not mentioned in the doc, but a foreach sentence can be stopped with break. Ex. // result from mysql_fetch_row() foreach ($recs as $id=>$rec) { if($id=="5") { break; } else { print ..... } hope it helps. -- http://www.php.net/manual/en/control-structures.foreach.php http://master.php.net/manage/user-notes.php?action=edit+23312 http://master.php.net/manage/user-notes.php?action=delete+23312 http://master.php.net/manage/user-notes.php?action=reject+23312

« previous php.notes (#33080) next »