3v4l.org

run code in 500+ PHP versions simultaneously
<?php require_once './functionPHP.php'; class Users { public $_email; public $_password; public $_error = ''; public $_showBooks = false; protected $_userId = null; public function __construct($email, $password) { $this->_email = $email; $this->_password = $password; } public function Check() { if ($this->_email != '' && $this->_password != '') { $connect = connect(); $email = mysqli_real_escape_string($connect, $this->_email); $query = "SELECT user_id, user_password FROM users WHERE user_email = '$email'"; $result = mysqli_query($connect, $query); if (mysqli_num_rows($result) == 1) { $user = mysqli_fetch_assoc($result); if ($this->_password == $user['user_password']) { $this->_showBooks = true; $this->_userId = $user['user_id']; } else { $this->_error = 'Неверный пароль'; } } else { $this->_error = 'Пользователь с таким email не найден'; } mysqli_close($connect); } else { $this->_error = 'Заполните оба поля'; } } public function getError() { return $this->_error; } public function getShowBooks() { return $this->_showBooks; } public function getId() { return $this->_userId; } } class Registration { public string $_email; public string $_password; public string $_repeatPassword; public array $_errors = []; public bool $_success = false; public function __construct(string $email, string $password, string $repeatPassword) { $this->_email = htmlentities($email); $this->_password = htmlentities($password); $this->_repeatPassword = htmlentities($repeatPassword); } public function register(): void { $connect = connect(); if ($this->_password !== $this->_repeatPassword) { echo $this->_errors[] = 'Введите одинаковые пароли'; return; } $email = mysqli_real_escape_string($connect, $this->_email); $query = "SELECT COUNT(*) AS `count` FROM `users` WHERE `user_email` = '$email'"; $result = mysqli_query($connect, $query); $count = mysqli_fetch_assoc($result)['count']; if ($count > 0) { echo $this->_errors[] = 'Такой email уже существует'; mysqli_close($connect); return; } $query = "INSERT INTO `users` (user_email, user_password) VALUES ('$email', '{$this->_password}')"; mysqli_query($connect, $query); mysqli_close($connect); $this->_success = true; } public function getErrors(): array { return $this->_errors; } public function isSuccess(): bool { return $this->_success; } } class Logout{ public static function exit() { session_destroy(); header('Location: ./авторизация.php'); exit; } }

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)
8.5.30.0300.01016.56
8.5.20.0340.00616.63
8.5.10.0220.01016.61
8.5.00.0350.00616.56
8.4.180.0340.01119.68
8.4.170.0340.01119.60
8.4.160.0360.00919.77
8.4.150.0290.00519.75
8.4.140.0320.00917.64
8.4.130.0340.00817.71
8.4.120.0350.01117.93
8.4.110.0400.00917.81
8.4.100.0280.00617.84
8.4.90.0320.01118.07
8.4.80.0360.00918.05
8.4.70.0290.00918.05
8.4.60.0300.00818.08
8.4.50.0340.00617.67
8.4.40.0380.01017.59
8.4.30.0400.00717.60
8.4.20.0410.00617.60
8.4.10.0400.00717.71
8.3.300.0360.00818.28
8.3.290.0440.00718.41
8.3.280.0240.01418.12
8.3.270.0320.01116.72
8.3.260.0330.00916.58
8.3.250.0360.00716.63
8.3.240.0360.01316.80
8.3.230.0360.01116.56
8.3.220.0410.00316.79
8.3.210.0300.01216.84
8.3.200.0360.00916.63
8.3.190.0370.00716.58
8.3.180.0320.01316.76
8.3.170.0430.00716.56
8.3.160.0330.00716.76
8.3.150.0350.00516.56
8.3.140.0340.01116.73
8.3.130.0300.01216.56
8.3.120.0340.00616.74
8.3.110.0270.00816.91
8.3.100.0400.00516.70
8.3.90.0330.00816.80
8.3.80.0350.00616.65
8.3.70.0340.01116.92
8.3.60.0310.01116.65
8.3.50.0400.00716.56
8.3.40.0370.00817.85
8.3.30.0290.00717.86
8.3.20.0280.00917.93
8.3.10.0280.01217.61
8.3.00.0320.00817.87

preferences:
42.62 ms | 722 KiB | 5 Q