Skip to content

Instantly share code, notes, and snippets.

@Div-Man
Div-Man / singleton.php
Created May 22, 2023 22:17 — forked from kamrankr/singleton.php
Php Singleton example
<?php
class Mysingleton
{
private static $instance;
private function __construct()
{}
public static function getInstance()
{
if ( self::$instance == NULL )
@Div-Man
Div-Man / polymorphism.php
Created May 22, 2023 22:16 — forked from kamrankr/polymorphism.php
simplest Polymorphism example in Php
<?php
/* simplest Polymorphism example in Php */
abstract class Animal
{
static function makeSound(Animal $animal)
{
return $animal->getsound();
}
}