note 28163 added to language.oop
| From: | tomcat at techie dot com | Date: | Sat, 04 Jan 2003 07:48:05 +0000 |
| Subject: | note 28163 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41653@lists.php.net to get a copy of this message | ||
Creating Object collection is very easy in PHP. Actually, regular array can serve as one:
class user {
var $login;
var $email;
var $password;
function user ( $login, $email, $password ) {
$this->login = $login;
$this->email = $email;
$this->password=$password;
}
}
$arrOBJ = array(); //This line is unnecessary, I would just use it to make code more readable. You
can remove.
$arrOBJ[] = new user("1","1","1");
$arrOBJ[] = new user("2","2","2");
echo "success: ".$arrOBJ[0]->login;
--
http://www.php.net/manual/en/language.oop.php
http://master.php.net/manage/user-notes.php?action=edit+28163
http://master.php.net/manage/user-notes.php?action=delete+28163
http://master.php.net/manage/user-notes.php?action=reject+28163