if want to call parent class constructor in php
<?php
/**
*Inheritance: It means accessing property of parent class from child class.
*
* */
class Animal
{
function __construct()
{
echo '<br>construct1';
}
function fun1()
{
echo '<br>fun1';
}
}
class Dog extends Animal
{
function __construct()
{
// if want to call parent class constructor
parent::__construct();
echo '<br>construct2';
}
function fun1()
{
echo '<br>Dog class function called';
}
}
$obj = new Dog();
$obj ->fun1();
?>