home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomePHP CookbookSearch this book

7.2. Instantiating Objects

7.2.3. Discussion

You can instantiate multiple instances of the same object:

$adam = new user;
$adam->load_info('adam');

$dave = new user;
$dave->load_info('adam');

These are two independent objects that happen to have identical information. They're like identical twins; they may start off the same, but they go on to live separate lives.

7.2.4. See Also

Recipe 7.5 for more on copying objects; Recipe 7.6 for more on copying objects by reference; documentation on classes and objects at http://www.php.net/oop.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.