I have an object, let's say it's like this:
class Foo {
var $b, $a, $r;
function __construct($B, $A, $R) {
$this->b = $B;
$this->a = $A;
$this->r = $R;
}
}
$f = new Foo(1, 2, 3);
I want to get an arbitrary slice of this object's properties as an array.
$desiredProperties = array('b', 'r');
$output = magicHere($foo, $desiredProperties);
print_r($output);
// array(
// "b" => 1,
// "r" => 3
// )