note 23406 added to language.oop

From: Date: Wed, 17 Jul 2002 17:35:35 +0000
Subject: note 23406 added to language.oop
Groups: php.notes 
Request: Send a blank email to php-notes+get-33217@lists.php.net to get a copy of this message
To create an array of objects, try the following: class Test{ function Test($temp){ $this->a = $temp; } function print_a(){ echo $this->a; } } $myObj = array(); for($i = 0; $i < 10; $i++) $myObj[] = new Test($i); $myObj[9]->print_a(); Granted there are many ways to create you array. This is just a quick example. -- http://www.php.net/manual/en/language.oop.php http://master.php.net/manage/user-notes.php?action=edit+23406 http://master.php.net/manage/user-notes.php?action=delete+23406 http://master.php.net/manage/user-notes.php?action=reject+23406

« previous php.notes (#33217) next »