PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
class Example
{
var $pass;
/*
* Rest of your code in here ...
*/
}
// create an Example object
$e = new Example();
$e->pass = $user_password;
Of course you may wish to implement a setter method, but (someone correct me if I'm wrong!) to enforce getting/setting of properties like that you would probably need to write in PHP 5. You might also set your user and pass members via a constructor:
class Example
{
var $pass;
var $user;
function Example($user, $pass)
{
$this->pass = $pass; // Validate the values
$this->user = $user; // first of course!
}
/*
* Rest of your code in here ...
*/
}
// create an Example object
$e = new Example($username, $userpass);