KieranA001 Posted January 27, 2013 Share Posted January 27, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/273693-php-person-class-how/ Share on other sites More sharing options...
kicken Posted January 27, 2013 Share Posted January 27, 2013 These should get you started. If you can't get it working, post whatever code you've tried to write: OOP Basics Properties Quote Link to comment https://forums.phpfreaks.com/topic/273693-php-person-class-how/#findComment-1408525 Share on other sites More sharing options...
KieranA001 Posted January 27, 2013 Author Share Posted January 27, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/273693-php-person-class-how/#findComment-1408526 Share on other sites More sharing options...
Christian F. Posted January 27, 2013 Share Posted January 27, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273693-php-person-class-how/#findComment-1408527 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.