Last active
November 21, 2015 15:54
-
-
Save bulton-fr/182e0949594547256951 to your computer and use it in GitHub Desktop.
Time to call parent class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
//somes attributes and methods | |
public function display() | |
{ | |
//somes actions... | |
} | |
} | |
class Bar extends Foo | |
{ | |
//somes attributes and methods | |
public function display() | |
{ | |
parent::display(); | |
} | |
} | |
$bar = new Bar; | |
$bar->display(); //Time 0.3sec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
//somes attributes and methods | |
public function display() | |
{ | |
//somes actions... | |
} | |
} | |
class Bar extends Foo | |
{ | |
//somes attributes and methods | |
} | |
$bar = new Bar; | |
$bar->display(); //Time 1.2sec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment