|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-08-12 02:29 UTC] ronen at greyzone dot com
@foreach($items as $key => $val) {}
does not work:
<?
$test[123]="one hundred twenty three";
$test[13]="thirteen";
$test[11]="eleven";
// try to supress warnings on foreach
@foreach($test as $key => $value) {
echo "TEST[$key]=$value<br>";
}
/***** THE OUTPUT IS
Parse error: parse error in /home/httpd/brocadedocs/ronen/secure/testtest.html on line 10
****/
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 00:00:02 2025 UTC |
I'd just like to add a vote for this as a new feature. I have countless foreach blocks wrapped in if( is_array( $x ) ){} where the only reason to check is to avoid raising a warning.just as 'slight_ at hotmail dot com ' had put it, they best way to get rid of it is a simple if/else loop, say if(!$x) { echo "error" } else { //code// } it worked on my the website i am developing so hopefully it'll work for you