Skip to content

Instantly share code, notes, and snippets.

@eryshkov
Created December 4, 2019 21:14
Show Gist options
  • Save eryshkov/7b5afda1ea0ade5a14a78da0d55ac998 to your computer and use it in GitHub Desktop.
Save eryshkov/7b5afda1ea0ade5a14a78da0d55ac998 to your computer and use it in GitHub Desktop.
[Singletone]
<?php
class Singletone {
private static $instance;
private function __construct()
{
}
public static function instance() {
if (!isset(static::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
}
$foo = Singletone::instance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment