Re: problems accesing an object via globals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




however this will work...

p1.inc

 1 <?php
  2
  3 class dbb{
  4
  5 var $var=10;
  6
  7    function fun2(){
  8       return $this->var;;
  9    }
 10 }
 11
 12 class obj {
 13    var $obj2=20;
 14
 15    function f1(){
 16       global $db;
 17
 18       echo "\n".$db->fun2()*$this->obj2."\n";
 19    }
 20 }
 21 ?>


 1 #!/usr/bin/php -q
  2
  3 <?php
  4
  5 require_once('p1.inc');
  6
  7 $db= new dbb();
  8
  9
 10 $obj = new obj();
 11
 12 $obj->f1();
 13
 14 ?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux