You are here: Re: concatenate object variable name « PHP Programming Language « IT news, forums, messages
Re: concatenate object variable name

Posted by Bosconian on 10/11/05 06:39

"Bosconian" <bosconian@planetx.com> wrote in message
news:P7mdnYTMUJp7Jt3eRVn-tA@comcast.com...
> I have form values stored in an object.
>
> I have a set of numbered form fields:
>
> specialty1
> specialty2
> specialty3
>
> I need to loop through these, check for content and process accordingly. I
> can't figure out how to correctly concatenate the number to the end of the
> field name. For example:
>
> for ($i = 1; $i <= 3; $i++) {
> if (eval("$node->specialty" . $i)) {
> //do something
> }
> }
> I know eval is slow, but what other options are there?
>
> Thanks.
>
>

When concatenating objects in the above example simply

$node->specialty . $i

eval is not needed.

 

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

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