Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Cycle through class variables
- Mike Moum
February 18, 2010, 5:07 pm
rate this thread
With arrays, one can cycle through the elements of the array with a
foreach loop. Is there any way to cycle through the variables of a class?
For example, we might have a class named X, and instance x of the class,
and variables $x->id, $x->lastname, $x->firstname, and so on. Is there a
way to cycle through all the variables to get the variable names and
values like there is with an associate array?
February 18, 2010, 5:16 pm
Re: Cycle through class variables
El 18/02/2010 18:07, Mike Moum escribió/wrote:
I haven't tried myself but it seems you can:
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com