4 ms·
That's why I put the word reflection inside quotes, I wasn't talking about the proper reflection API, but about functions like get_class_methods, and stuff like
by glassx 15y ago
That's why I put the word reflection inside quotes, I wasn't talking about the proper reflection API, but about functions like get_class_methods, and stuff like $$.
Here's an example similar to yours:
$a = new A;
foreach(get_object_vars($a) as $name => $var) {
$a->$name = $a->$name + 1;
echo $a->$name . "\n";
}
Also I'm a newbie when it comes to PHP, I never worked with, and I've been programming for almost a decade. Sorry if I didn't make it clear. I just wanted to make a positive comment on the cool aspects of a language which is mostly bashed around these parts.