3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * Class User * Application/controller/user.php */ class User extends Controller { function my__construct($user_model) { include 'application/model/usermodel.php'; } spl_autoload_register('my__construct'); public function index() { // load views/partials. require 'application/views/partials/header.php'; require 'application/views/partials/footer.php'; // run the login() method in the login-model, put the result in $login_successful (true or false) // perform the login method, put result (true or false) into $login_successful $login_successful = $user_model->login(); // check login status if ($login_successful) { // if YES, then move user to dashboard/index (btw this is a browser-redirection, not a rendered view!) header('location: ' . URL . 'user/profile'); } else { // if NO, then move user to login/index (login form) again header('location: ' . URL . 'user/access'); } } public function access() { // @TODO fix $this->view->render require 'application/views/partials/header.php'; require 'application/views/user/access.php'; require 'application/views/partials/footer.php'; }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'spl_autoload_register' (T_STRING), expecting function (T_FUNCTION) in /in/YrgWu on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /in/YrgWu on line 13
Process exited with code 255.