note 80139 added to control-structures.foreach
| From: | spitfire at osu1 dot php dot net | Date: | Mon, 31 Dec 2007 10:10:17 +0000 |
| Subject: | note 80139 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134599@lists.php.net to get a copy of this message | ||
<?php
// lol, in one of the examples there's a code like that:
$arr = array("jeden", "dwa", "trzy");
reset ($tabl);
while (list(, $wartoÅÄ) = each ($tabl)) {
echo "WartoÅÄ: $wartoÅÄ<br>\n";
}
foreach ($tabl as $wartoÅÄ) {
echo "WartoÅÄ: $wartoÅÄ<br>\n";
}
// but what do you want to do with this script?
// use foreach(); on non-existable board?
// $arr should be replaced with $tabl
// so the good code looks like that:
$tabl = array("jeden", "dwa", "trzy");
reset ($tabl);
while (list(, $wartoÅÄ) = each ($tabl)) {
echo "WartoÅÄ: $wartoÅÄ<br>\n";
}
foreach ($tabl as $wartoÅÄ) {
echo "WartoÅÄ: $wartoÅÄ<br>\n";
}
// thank you :)
----
Server IP: 82.177.164.100
Probable Submitter: 83.24.180.251
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/80139
Del: integrated -- https://master.php.net/note/delete/80139/integrated
Del: useless -- https://master.php.net/note/delete/80139/useless
Del: bad code -- https://master.php.net/note/delete/80139/bad+code
Del: spam -- https://master.php.net/note/delete/80139/spam
Del: non-english -- https://master.php.net/note/delete/80139/non-english
Del: in docs -- https://master.php.net/note/delete/80139/in+docs
Del: other reasons-- https://master.php.net/note/delete/80139
Reject -- https://master.php.net/note/reject/80139
Search -- https://master.php.net/manage/user-notes.php