3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php final class db extends PDO { private $engine; private $host; private $database; private $user; private $pass; private $charset; private static $link = null ; public static VirtualDeletion = array( 'on' => false, 'Field' => '', 'Value' => '' ); public function __construct() { return self::i(); } public static function i() { if (!self::$link) return self::$link; $this->engine = 'mysql'; $this->host = 'localhost'; $this->database = ''; $this->user = 'root'; $this->pass = ''; $this->charset = 'utf8'; $dsn = $this->engine .":dbname=". $this->database .";charset=". $this->charset .";host=". $this->host; self::$link = parent::__construct( $dsn, $this->user, $this->pass ); /* PHP < 5.3.6 self::$link->exec("set names utf8"); */ return self::$link; } public function __destruct() { if(self::$link) { /* Estudar as implicações disto: if(PDO::inTransaction()) self::$link->commit(); */ self::$link = null; } } }
Output for 5.4.0 - 5.5.8
Parse error: syntax error, unexpected 'VirtualDeletion' (T_STRING), expecting variable (T_VARIABLE) in /in/rYcPH on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/rYcPH on line 14
Process exited with code 255.