Defining an object constructor
class user {
public $username;
function __construct($username, $password) {
if ($this->validate_user($username, $password)) {
$this->username = $username;
}
}
}
$user = new user('A', 'M');
Related examples in the same category