Sunday, June 16, 2013

Class Construct Method

Using The Class Construct Method In Php

//The difference between normal class methods and construct class methods//

class exampleOne
{
function sayHello()
{
echo 'Hello !';
}//end function
}//end class
//now to execute our class
$ourexample = new exampleOne;
$ourexample->sayHello();

class exampleTwo
{
public function __construct()
{
$this->sayHowdy();
}//end function construct

public function sayHowdy()
{
echo 'Howdy !';
}//end function
}//end class
// now we can call and execute the class using only one line below//
$example = new exampleTwo;