Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // cf. http://stackoverflow.com/questions/40230045/why-should-i-declare-the-class-property-in-php
- class account {
- public function __construct($username, $password) {
- $this->username = $username;
- $this->password = $password;
- }
- public function getPassword() {
- return str_repeat('*', strlen($this->password));
- }
- }
- $a = new account('brandizzi', 'MySecretPassword');
- echo $a->getPassword() . "\n";
- echo $a->password . "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement