In PHP one can use variable variables...
For example...
class obj { } $fieldName = \"Surname\"; $object = new obj(); $object->Name = \"John\"; $objec
Validating with RegEx if you wanted to allow $ or &$ (pass variable by reference) to be validated in the string, you could use this regex:
$
&$
/^([\$]|(&\$))[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/