skip a row in foreach loop
| From: | afan@afan.net | Date: | Wed, 03 Aug 2005 15:46:55 +0000 |
| Subject: | skip a row in foreach loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-219903@lists.php.net to get a copy of this message | ||
I have a code
foreach($results as $key => $value)
{
echo $key.': '. $value .'<br>';
}
But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?
I know I can do
foreach($results as $key => $value)
{
if(!empty($value))
{
echo $key.': '. $value .'<br>';} } but there is a tons of code lines inside the loop and was thingking is there any part in foreach function that can do that? something like: foraech($results as $key => $value, skip(empty($value))) { // } Tahnks.