help thx

I must create PHP CLASS USER with this values : id, first_name, last_name, age. Class must have: constructor of class Method that returns the name of the user Method that returns a boolean value about user age validation can you help me? Thanks
Boncz SzilardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Here is a sample
class user
  protected $id;
  protected $first_name;
  protected $last_name;
  protected $age;

  public function __construct($id, $first_name, $last_name, $age)
    $this->id = $id;
    $this->first_name = $first_name;   
    $this->last_name = $last_name;
    $this->age = $age;
  public function getFirstName()
    return $this->first_name;

  public function isAgeValid()
      return ($this->age > 1 && $this->age < 99);

$person = new User(1, 'Fred', 'Smith', 21);
echo "Hello " . $person->getFirstName();
If (!$person->isAgeValid()) {
  echo "Please can I see some ID";

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Boncz SzilardAuthor Commented:
Thank you
Julian HansenCommented:
@Boncz, I see you are a new addition to the EE community apologies for not welcoming you earlier.

It appears from your last comment that you are happy with the solution. If you have received an answer to your question the next step is to close the question. You can do this by clicking the button "Assisted Solution" (if you think more than one answer is valid - not really an option in this case - but for future reference) and "Best Solution" for the answer that best answers the question. If only one post answers the question then simply click "Best Solution" on that answer and follow the wizard.

Look forward to seeing more of you on the forums
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Boncz SzilardAuthor Commented:
Ahhh sorrry thx
Julian HansenCommented:
No problem - but could I ask you to grade it again. At EE we try to make questions useful to the next person who comes along - so the accepted answer needs to relate to the question. If you could rather accept the first comment as it relates to the question - that would be great.

Boncz SzilardAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.