How do I get the following code not to blow up in my face?
<?php
class abc{
}
abc::$someDynamicVariable
?>
I don’t really want to declare the variable before hand, and was hoping I could declare it in the __construct function ( javascript functions’ arguments array anyone? )
The error I get is:
Fatal error: Access to undeclared static property: abc::$someDynamicVariable in
You may use PHPs Magic Methods
__set()and__get()to set/get properties dynamic which do not exist so far.Here is an example: