Hello freaks,
I am having quite a difficult time working out how to use an instance of a certain class in all instances of all objects.
Example:
this is my main file ( index etc. ),
<?php $a = new User(); $b = new HeaderBuilder($_SESSION['userid']); ?>
HeaderBuilder:
<?php class HeaderBuilder{ function __construct($id){ echo $a->getUserById($id); } }
Now my question is how do I use $a in HeaderBuilder's __construct without creating a new instance ?