Welcome Guest, Not a member yet? Register   Sign In
Super-Noob question
#1

[eluser]taewoo[/eluser]
Sorry if this place is the wrong place to post but i'm a CI developer and i didn't know where to ask this... so apologies in advance.

Ok, so I never formally learned PHP... i just picked it up as I learned CI.

If i have a class and it has member "var_x"... I reference it by
Code:
$object->var_x;

But is there a way I can do this?

Code:
$field="var_x";
$object->{$field};

I remember seeing something like this in FreakAuth and i was blow away (i don't know why) but i can't seem to recall the correct method..
#2

[eluser]taewoo[/eluser]
Ok never mind.. i answered my own question.
Please disregard.
#3

[eluser]maesk[/eluser]
The concept ist called "dynamic variables" or "variable variables"
http://www.php.net/manual/en/language.va...riable.php




Theme © iAndrew 2016 - Forum software by © MyBB