wolves Posted April 19, 2006 Share Posted April 19, 2006 HI[code] class a { public $data; public function __construct($data) { this->data = $data; } } class b { public $itens = Array(); public function add_item($item) { $this->itens[] = new a($item); } public function get() { print_r($this->itens); } } class c { public $test = Array(); public function &do_b() { $this->test = new b(); return $this->test[sizeof($this->test)-1]; } public function get() { foreach($test as $tt ) { $tt->get(); } } } } $test = new c; $bclass = $test->do_b(); $bclass->add_item("hello"); $bclass->add_item("hi"); $test->get();[/code] ok in my machine $test->get will print "hello", "hi" ..... but at my server it not works, it's print nothing "Array()" why ? Quote Link to comment Share on other sites More sharing options...
ober Posted April 19, 2006 Share Posted April 19, 2006 Are the PHP versions the same? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.