Jump to content

Recommended Posts

Hello guys, I really need some help in PHP but don't know what to do. Now, I'm not going to lie it's an assignment and I don't know what to do. If you guys can write me a this is PHP then I would be very gratefull. Thanks for looking :-)

 

Here is what I'm suppose to do:

 

The making of a person class in PHP that has the following properties and methods:

 

a first name property;

a second name property;

a date of birth property;

a method that allows the setting of the class's first name;

a method that allows the setting of the class's second name;

a method that allows the setting of the class's date of birth and methods to get the values of the three properties.

The instantiation of the person class using a constructor to set all the class's properties

Link to comment
https://forums.phpfreaks.com/topic/273693-php-person-class-how/
Share on other sites

I managed to get the first part which is the first name, second name and the age. I don't know how to:

 

a method that allows the setting of the class's first name;

a method that allows the setting of the class's second name;

a method that allows the setting of the class's date of birth and methods to get the values of the three properties.

The instantiation of the person class using a constructor to set all the class's properties

 

Here is what I've done so far through videos on youtube. :-)

person_class.php

First off: No, we will not write the PHP code for you. That would be cheating, us doing the work for you, and you not learning.

Follow the links that kicken gave above, and read up on the OOP syntax and terminology.

 

The methods (class functions) that you're looking to write are called "setters" in the OOP terminology, and they are almost as basic as you can get them. Only "getters" are more basic. The resources linked to above will explain how to make them.

 

Also, please post your code using the [code][/code] tags. Very few people want to download files, and the easier you make it for us to help you the higher the chances of you getting help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.