Tuesday, 20 August 2013

Dealing with special characters in object property names

Dealing with special characters in object property names

I am working with a database created by a university professor's intern.
Many of the fields have names like 'Revenues_(budget)'.
Currently when working with objects that have the fields as properties I
do something like
$f = 'Revenues_(budget)';
echo $obj->$f;
This works fine but I was wondering if there might be a more elegant or at
least concise way to handle these?

No comments:

Post a Comment