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


Book HomePHP CookbookSearch this book

7.3. Defining Object Constructors

7.3.2. Solution

Define a method with the same name as the class:

class user {
    function user($username, $password) {
        ...
    }
}

7.3.4. See Also

Recipe 7.8 for more on calling parent constructors; documentation on object constructors at http://www.php.net/oop.constructor.



Library Navigation Links

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