I am dealing with an object of a class that I did not write and cannot change.This class has a very large number of attributes. I want to cycle trough about half of these attributes (a select group). I put the names of the nescessary attributes into an array and would like to cycle through them. Is this possible? What is the syntax like?
class B{
public $foo = 'hi';
public $bar = 'bye';
...etc, etc.
}
$arr = array(1=>'foo', 2=>'bar', ...)
$b = new B();
foreach($arr as $val){
echo $b->($val); //<-----does not work
}