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 | |
/* simplest Polymorphism example in Php */ | |
abstract class Animal | |
{ | |
static function makeSound(Animal $animal) | |
{ | |
return $animal->getsound(); | |
} | |
} | |
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 Mysingleton | |
{ | |
private static $instance; | |
private function __construct() | |
{} | |
public static function getInstance() | |
{ | |
if ( self::$instance == NULL ) |