3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function generateRandomString() { return 4; } class Connection { public function execute($query) { return true; } } class ConnectionFactory { public static CreateConnection() { return new Connection; } } function pg_escape($data) { return $data; } class LocalAuth { protected $login; protected $pass; protected $salt; function Store(){ $db = ConnectionFactory::CreateConnection(); $q = "insert into localauth (login, pass, salt) values ('".$this->login."','".$this->pass."','".$this->salt."');"; $db->execute($q); } } $auth= new LocalAuth(); $auth->login= pg_escape($_POST['login']); $auth->pass= pg_escape($_POST['pass']); $auth->salt = generateRandomString(); $auth->Store();
Output for 5.4.0 - 5.4.19
Parse error: syntax error, unexpected 'CreateConnection' (T_STRING), expecting variable (T_VARIABLE) in /in/IXII2 on line 18
Process exited with code 255.
Output for 5.2.15 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/IXII2 on line 18
Process exited with code 255.