I am trying to use a class within a class, but seem to be having an issue with the initialised content of the class. It can see the class structure fine if you do a var_dump, but it wont see the content you have initialised with. I know im probably missing something pretty obvious, any pointers would be great. An example is below...
class firstClass() { public $thedate; function __construct() { $this->thedate = date(); } } class secondClass() { public $datefrom1stclass; function __construct() { $this->datefrom1stclass = new firstClass; echo $this->datefrom1stclass->thedate; } } Sorry if I have not explained very well, If I do a var_dump I get the following:
object(firstClass)#3 (1) { ["thedate"]=> NULL } Any pointers would be appreciated!
date(), it works fine: codepad.org/kDvuEWR3