Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class output{
  2. public $data=array();
  3. function __construct__(){
  4. }
  5. function setSomething(){
  6. $this->data[] = 'frog';
  7. }
  8. }
  9.  
  10. class template{
  11. function __construct__(&$output){
  12. $this->output = $output;
  13. }
  14. function myFunction(){
  15. print_r($this->output->data;)
  16. }
  17. }
  18.  
  19. $output = new output();
  20.  
  21. $template = new template($output);
  22.  
  23. // What I had added: $template->output = $output; <=== STUPID
  24.  
  25. $output->setSomething();
  26.  
  27. $template->myFunction();
Add Comment
Please, Sign In to add comment