In PHP one can use variable variables...
For example...
class obj { } $fieldName = \"Surname\"; $object = new obj(); $object->Name = \"John\"; $objec
'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' will validate a PHP variable name.
'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
This regex is directly from the documentation at: http://www.php.net/manual/en/language.variables.basics.php