3v4l.org

run code in 300+ PHP versions simultaneously
<?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'; } public function create() { $user_model = $this->loadModel('UserModel'); //check if we have POST data to create a new user if (isset($_POST["submit_add_user"])) { //@TODO Add password encryption, prefered BCrypt. $user_model->create($_POST["fornavn"], $_POST["efternavn"], $_POST["sted"], $_POST["password"], $_POST["email"]); } // where to go after user has been added header('location: ' . URL . 'user/access'); } public function delete() { // if we have an id of a user that should be deleted if (isset($user_id)) { $user_model->deleteUser($user_id); } // where to go after user has been deleted header('location: ' . URL . 'user/access'); } public function profile() { // Fetch user details for form to edit $user_details = $user_model->user(); } }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.280.0060.03412.38
5.4.270.0040.03812.38
5.4.260.0050.04012.38
5.4.250.0030.04212.38
5.4.240.0110.03512.38
5.4.230.0080.03812.37
5.4.220.0050.04012.37
5.4.210.0120.04412.37
5.4.200.0060.04012.37
5.4.190.0050.03812.37
5.4.180.0070.03812.37
5.4.170.0140.05612.38
5.4.160.0060.05312.38
5.4.150.0080.05512.37
5.4.140.0120.05012.06
5.4.130.0140.05412.04
5.4.120.0110.05612.00
5.4.110.0090.04712.01
5.4.100.0110.05012.00
5.4.90.0130.05512.00
5.4.80.0060.05912.01
5.4.70.0090.04912.00
5.4.60.0130.05012.00
5.4.50.0100.05212.00
5.4.40.0060.05511.98
5.4.30.0120.04711.98
5.4.20.0090.05811.98
5.4.10.0080.05911.99
5.4.00.0100.06511.48
5.3.280.0090.05712.71
5.3.270.0090.05512.73
5.3.260.0160.08812.71
5.3.250.0070.05812.72
5.3.240.0140.06212.72
5.3.230.0170.05012.71
5.3.220.0090.05512.68
5.3.210.0080.04412.68
5.3.200.0100.04712.68
5.3.190.0100.04712.68
5.3.180.0190.06712.67
5.3.170.0090.05712.67
5.3.160.0150.05512.67
5.3.150.0120.05012.67
5.3.140.0130.04812.66
5.3.130.0040.04212.66
5.3.120.0100.03812.66
5.3.110.0090.03712.65
5.3.100.0140.04512.12
5.3.90.0050.04112.09
5.3.80.0080.05812.08
5.3.70.0130.06012.07
5.3.60.0100.04612.06
5.3.50.0130.05212.00
5.3.40.0120.05312.00
5.3.30.0110.05011.95
5.3.20.0090.04911.73
5.3.10.0140.05711.70
5.3.00.0240.06511.69

preferences:
142.79 ms | 1394 KiB | 7 Q