<?php
class Users{
public $name;
public $idade;
public $email;
private $senha;
function __construct($name, $idade, $email, $senha){
$this->name = (string) $name;
$this->idade = (int) $idade;
$this->email = (string) $email;
$this->setPassword($senha);
echo "O objeto foi contruido!";
}
function setPassword($senha){
$this->senha = password_hash($senha, PASSWORD_DEFAULT);
else:
die ('Sua senha deve conter entre 8 e 13 caracters'); endif;
}
}
$pessoa = new Users("Flavio", 19, "flvdeveloper@gmail.com", "testando123");
PD9waHAgCgkKCWNsYXNzIFVzZXJzewoJCXB1YmxpYyAkbmFtZTsgCgkJcHVibGljICRpZGFkZTsKCQlwdWJsaWMgJGVtYWlsOwoJCXByaXZhdGUgJHNlbmhhOwoJCQoJCWZ1bmN0aW9uIF9fY29uc3RydWN0KCRuYW1lLCAkaWRhZGUsICRlbWFpbCwgJHNlbmhhKXsKCQkgICAgJHRoaXMtPm5hbWUgPSAoc3RyaW5nKSAkbmFtZTsKCQkgICAgJHRoaXMtPmlkYWRlID0gKGludCkgJGlkYWRlOwoJCSAgICAkdGhpcy0+ZW1haWwgPSAoc3RyaW5nKSAkZW1haWw7CgkJICAgICR0aGlzLT5zZXRQYXNzd29yZCgkc2VuaGEpOwoJCSAgICBlY2hvICJPIG9iamV0byBmb2kgY29udHJ1aWRvISI7CgkJfQoKCQlmdW5jdGlvbiBzZXRQYXNzd29yZCgkc2VuaGEpewoJCSAgICBpZiAoc3RybGVuKCRzZW5oYSkgPiA4IGFuZCBzdHJsZW4oJHNlbmhhKSA8IDEzKToKCQkgICAgICAgICR0aGlzLT5zZW5oYSA9IHBhc3N3b3JkX2hhc2goJHNlbmhhLCBQQVNTV09SRF9ERUZBVUxUKTsKCQkgICAgZWxzZToKCQkgICAgICAgIGRpZSAoJ1N1YSBzZW5oYSBkZXZlIGNvbnRlciBlbnRyZSA4IGUgMTMgY2FyYWN0ZXJzJyk7CgkJICAgIGVuZGlmOwoJCX0KCX0KCQoJJHBlc3NvYSA9IG5ldyBVc2VycygiRmxhdmlvIiwgMTksICJmbHZkZXZlbG9wZXJAZ21haWwuY29tIiwgInRlc3RhbmRvMTIzIik7Cgl2YXJfZHVtcCgkcGVzc29hKTs=