VB icon

Inheritance in PHP

Email
Submitted on: 7/31/2015 1:45:21 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: PHP 4.0, PHP 5.0
Views: 3886
author picture
 
     As I learned programming specially PHP one of my favorite web programming language I have to admit that some of the advance concepts like object oriented programming I'm not yet equip with. One of its is the concept of inheritance this concepts is one of the most important aspect in object oriented programming not only in PHP but other programming language like Java and C#. Inheritance teaches us how to use the attributes and methods from the parent class. It makes our programming much easier in a sense that we use existing codes in the library class file specially we are using web frameworks like codeigniter, laravel, magento and many others. I hope you will find my program useful in learning the concepts of object oriented programming in PHP using the concepts of inheritance. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360. Thank you very much and Happy Programming.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Inheritance in PHP
// Description:As I learned programming specially PHP one of my favorite web programming language I have to admit that some of the advance concepts like object oriented programming I'm not yet equip with. One of its is the concept of inheritance this concepts is one of the most important aspect in object oriented programming not only in PHP but other programming language like Java and C#.
Inheritance teaches us how to use the attributes and methods from the parent class. It makes our programming much easier in a sense that we use existing codes in the library class file specially we are using web frameworks like codeigniter, laravel, magento and many others. I hope you will find my program useful in learning the concepts of object oriented programming in PHP using the concepts of inheritance.
If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
// By: Jake R. Pomperada
//**************************************

<?php
class user_details {
	
	public $name;
	public $address;
	public $age;
	public $email;
	
	function display_user_details() {
		echo "<font color='blue'>";
		echo "<h2> About the User </h1>";
		echo "<h4> Name: " .$this->name. "</h4>";
		echo "<h4> Address : " .$this->email. "</h4>";
		echo "<h4> Age : " .$this->age. "</h4>";
		echo "<h4> Email Address: " .$this->email. "</h4>";
		echo "</font>";
	}
}
class person extends user_details {
}
$user = new person;
$user->name='Willian Gates III';
$user->address= 'One Microsoft Way';
$user->age= 60;
$user->email= 'bill_gates@microsoft.com';
$user->display_user_details();
?>


Other 52 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.