<?php
class C{
private static $stmt;
private function __construct(){
}
public static function fx(){
if(!(self::$stmt instanceof self)){
self::$stmt=new self();
echo ‘ok’;
}
echo ‘no’;
return self::$stmt;
}
}
$pdo=C::fx();
$pdo1=C::fx();
var_dump($pdo===$pdo1)
?>