note 80139 deleted from control-structures.foreach by tularis
| From: | tularis@php.net | Date: | Mon, 31 Dec 2007 10:41:28 +0000 |
| Subject: | note 80139 deleted from control-structures.foreach by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134602@lists.php.net to get a copy of this message | ||
Note Submitter: spitfire
Reason: useless
----
<?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 :)