3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $pdo; private static $instance; private function __construct() { $this->pdo = new PDO(/* params here */); } public static function getInstance() { if (null === self::$instance) { $self::instance = new self(); } return self::$Instance; } /** * Just an example method to show * how to interact with the PDO instance */ public function queryAndFetch($query) { $stmt = $this->pdo->query($query); return $stmt->fetchAll(PDO::FETCH_ASSOC); } }
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '=' in /in/QOei8 on line 17
Process exited with code 255.

preferences:
191.83 ms | 1395 KiB | 67 Q