3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function login() { if(isset($_POST["user"]) && isset($_POST["password"])) { $postUserID = DataFormat::parsePersonID($_POST["user"]); if(!$postUserID) { return false; } $user = $this->db->getPerson($postUserID); if(!$user) { return false; } if ($user["activated"] == 0){ return false; } $hashedPassword = hash("sha512", $_POST["password"] . $user["salt"]); if($hashedPassword != $user["password"]) { return false; } if(!in_array($user["id"], $this->testUsers)) { return false; } $_SESSION["user"] = $user; $_SESSION["loginKey"] = $this->getLoginKey(); return true; } return false; }
Output for 5.4.18
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/IZo4n on line 2
Process exited with code 255.
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/2JPeU on line 2
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_PUBLIC in /in/2JPeU on line 2
Process exited with code 255.

preferences:
183.98 ms | 1395 KiB | 54 Q