3v4l.org

run code in 300+ PHP versions simultaneously
<?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.18 - 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.4.0 - 5.4.17
Parse error: syntax error, unexpected 'CreateConnection' (T_STRING), expecting variable (T_VARIABLE) in /in/m43Zd on line 18
Process exited with code 255.
Output for 5.3.4 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/m43Zd on line 18
Process exited with code 255.

preferences:
191.24 ms | 1395 KiB | 51 Q