An attribute is also know as data members and is used to hold data of a class.

Example:
Code:

class Person {
	var $first_name;
	var $last_name;
	
}
$person1=new Student();
echo  $person1->first_name="Andy";
echo $person1->last_name="Flower";

Output:

Andy
Flower

Explanation:

In the above example $first_name, $last_name are data members of class Person. These data members define the data that one Person Object will store.

eXTReMe Tracker