fork(7) download
  1. <?php
  2.  
  3. $txt = 'Hello World!';
  4.  
  5. class Mensagem
  6. {
  7. public function mostrar1()
  8. {
  9. global $txt;
  10. echo $txt;
  11. }
  12.  
  13. public function mostrar2()
  14. {
  15. $msg = $GLOBALS['txt'];
  16. echo $msg;
  17. }
  18. }
  19.  
  20. $msg = new Mensagem();
  21. $msg->mostrar1();
  22. $msg->mostrar2();
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Hello World!Hello World!