I need to access a php object property which I specify as variable.
$phpObj->$property
This $property might contain chars like dash(-), quotes, percent, even whitespace ect. PHP does not allow these chars to be used as variable names, resulting which I am unable to access these properties.
What would be a good solution to handle this? I’m open with encoding the $property to something alphanumeric first and then using it as property variable but this encoding should be unique for a particular string.
Eg, I want to make sure that $phpObj->First-Prop and $phpObj->first-prop should be identified differently.
only this may be problem:
variable/function/method/property definitions in php are not case-sensitive…