using classes in php

Following code gives you a basic idea of how to use class in php.

 

<?php

// Class declaration
class building 
	{
		var $height = 5;
		// declaring class variables.
	}

// Instantiating the class.

$b1 = new building();

$b2 = new building();


$b2->height = 10;
// changing object properties.

echo "Height of building1 is ". $b1->height ." and height of building2 is " . $b2->height;

// And output would be

// Height of building1 is 5 and height of building2 is 10

?>