You are here: Re: NEED HELP Incrementing a variable name « All PHP « IT news, forums, messages
Re: NEED HELP Incrementing a variable name

Posted by Peter van Schie on 09/30/45 11:33

Nitrous wrote:
> Hi I can't find info on how to achieve the following:
>
> I want to increment through the variable names I've already set.
> Specifically $general_image1, $general_image2 & $general_image3
>
> I need something like this code (that works !!)
>
> for($i=1; $i<4; $i++)
> {
> if($general_image[$i] != "&nbsp;")
> {
> blah blah...
> }
> }

I'm not sure as to what you're trying to accomplish exactly, but my
guess is that you want to iterate through the general_image array?
In that case you could use foreach, like:

<?php
foreach($general_image as $cur_image)
{
if ($cur_image != "&nbsp;")
{
// do your magic...
}
}
?>

HTH.
Peter.
--
http://www.phpforums.nl

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация