If I have code like this:
class Person {
$age;
$height;
$more_stuff_about_the_person;
function about() {
return /* Can I get the per
User defined variables names should be treated as totally transparent to the PHP compiler (or any compiler for that matter). The objects you create are just references to memory that point to the real object. Their name has no meaning. Name is a member of person.
You can, however, get the variables you want with get_defined_vars()
foreach (get_defined_vars() as $key => $val) {
if ($val instanceof Person) {
echo $key;
}
}
This should absolutely not be done, however, and the object would still need to know the order in which the variables were stored. No idea how you would calculate that.