3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Users_model extends CI_Model { protected $table_name = 'users'; // Добавляет пользователя в базу данных protected function signup_user($data = FALSE) { if (!is_array($data) || !$data) return FALSE; $this->db->insert($this->table_name, $data); return $this->db->insert_id(); } protected function delete($id = FALSE) { if (!$id) return FALSE; $this->db->delete($this->table_name, array('id' => $id)); return $this->db->affected_rows() ? TRUE : FALSE; } public function get_user_info($fields = '*', $user_id = FALSE, $where = FALSE) { if (!$user_id) return FALSE; if (!is_array($where)) $where = array('id' => (int)$user_id); $query = $this->db->select($fields)->get_where($this->table_name, $where); if ($query->num_rows()) { return $query->row(); } return FALSE; } protected function get_users($fields = '*', $where = FALSE, $from = FALSE, $limit = FALSE) { $this->db->select($fields); if (is_array($where)) $this->db->where($where); if ($from !== FALSE and $limit !== FALSE) $this->db->limit($from, $limit); $query = $this->db->get($this->table_name); if ($query->num_rows()) { return $query->result(); } return FALSE; } protected function get_current_user($fields = '*') { $user_id = $this->session->userdata('id'); $query = $this->db->select($fields)->get_where($this->table_name, array('id' => $user_id)); if ($query->num_rows()) { return $query->row(); } return FALSE; } protected function get_user_by_email($fields = '*', $email = FALSE) { if (!$email) return FALSE; $query = $this->db->select($fields)->get_where($this->table_name, array('login' => $email)); if ($query->num_rows()) { return $query->row(); } return FALSE; } protected function update_user_info($user_id = FALSE, $data = FALSE) { if (!$user_id or !$data) return FALSE; if (!$this->is_user_exist($user_id)) return FALSE; $this->db->where('id', $user_id)->update($this->table_name, $data); return $this->db->affected_rows() ? TRUE : FALSE; } protected function is_user_exist($user_id = FALSE) { if (!$user_id) return FALSE; $query = $this->db->select('id')->get_where($this->table_name, array('id' => $user_id)); return $query->num_rows() ? TRUE : FALSE; } public function is_email_exist($email = FALSE) { if (!$email) return FALSE; $query = $this->db->select('id')->get_where($this->table_name, array('login' => $email)); return $query->num_rows() ? TRUE : FALSE; } public function is_logged_in() { return (bool)$this->session->userdata('id'); } public function get_user_group() { return (int)$this->session->userdata('group'); } // Генерит случайные пароли protected function password_verify($password = '', $hash = '') { $this->load->helper('password'); return password_verify($password, $hash); } // Хеширует пароль пользователя protected function password_hash($password = FALSE) { $this->load->helper('password'); $this->load->helper('string'); $hash = password_hash($password, PASSWORD_DEFAULT, array("cost" => 10, "salt" => random_string('alnum', 25))); return $hash; } }

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.3.60.0040.01118.30
8.3.50.0080.00822.11
8.3.40.0070.01418.69
8.3.30.0070.01020.34
8.3.20.0040.00418.64
8.3.10.0050.00321.09
8.3.00.0040.00419.62
8.2.180.0120.00316.50
8.2.170.0100.01022.96
8.2.160.0070.00720.52
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0100.00026.16
8.2.120.0080.00019.79
8.2.110.0000.00920.35
8.2.100.0040.00817.84
8.2.90.0030.00519.07
8.2.80.0070.00019.34
8.2.70.0030.00917.63
8.2.60.0060.00318.04
8.2.50.0030.00718.07
8.2.40.0050.00319.94
8.2.30.0050.00321.22
8.2.20.0040.00417.70
8.2.10.0050.00317.73
8.2.00.0060.00317.75
8.1.280.0000.01425.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00922.67
8.1.230.0040.00721.04
8.1.220.0050.00318.77
8.1.210.0080.00019.16
8.1.200.0060.00317.35
8.1.190.0040.00417.65
8.1.180.0030.00618.10
8.1.170.0050.00518.78
8.1.160.0000.00818.88
8.1.150.0000.00818.63
8.1.140.0000.00817.45
8.1.130.0070.00017.74
8.1.120.0070.00317.37
8.1.110.0040.00417.38
8.1.100.0050.00317.53
8.1.90.0050.00317.48
8.1.80.0040.00417.54
8.1.70.0030.00317.36
8.1.60.0000.00717.48
8.1.50.0000.00717.48
8.1.40.0000.00817.47
8.1.30.0000.00817.68
8.1.20.0000.00817.64
8.1.10.0040.00417.53
8.1.00.0000.00817.44
8.0.300.0060.00319.94
8.0.290.0040.00417.18
8.0.280.0070.00018.50
8.0.270.0000.00717.33
8.0.260.0070.00016.91
8.0.250.0070.00017.08
8.0.240.0070.00316.96
8.0.230.0000.00717.09
8.0.220.0040.00416.95
8.0.210.0070.00016.89
8.0.200.0000.00716.93
8.0.190.0000.00717.07
8.0.180.0080.00017.02
8.0.170.0050.00316.98
8.0.160.0040.00416.86
8.0.150.0050.00216.93
8.0.140.0000.00716.98
8.0.130.0050.00013.43
8.0.120.0040.00416.83
8.0.110.0000.00816.81
8.0.100.0000.00816.83
8.0.90.0040.00416.80
8.0.80.0040.01416.91
8.0.70.0000.00716.92
8.0.60.0030.00516.79
8.0.50.0050.00216.79
8.0.30.0060.01317.06
8.0.20.0130.01117.40
8.0.10.0040.00417.07
8.0.00.0120.00616.78
7.4.330.0000.00516.67
7.4.320.0030.00316.47
7.4.300.0000.00716.66
7.4.290.0000.00716.60
7.4.280.0000.00716.50
7.4.270.0080.00016.38
7.4.260.0000.00513.27
7.4.250.0090.00016.50
7.4.240.0030.00316.51
7.4.230.0070.00016.43
7.4.220.0180.00716.36
7.4.210.0080.00816.50
7.4.200.0000.00716.53
7.4.190.0050.00216.43
7.4.160.0120.00416.41
7.4.150.0130.00317.40
7.4.140.0100.00817.86
7.4.130.0080.01216.52
7.4.120.0120.00616.51
7.4.110.0090.00916.50
7.4.100.0090.00816.46
7.4.90.0060.01216.69
7.4.80.0070.01519.39
7.4.70.0100.00616.51
7.4.60.0070.01116.50
7.4.50.0030.00616.51
7.4.40.0040.01422.77
7.4.30.0110.00716.32
7.3.330.0000.00513.18
7.3.320.0000.00713.12
7.3.310.0000.00716.13
7.3.300.0000.00716.28
7.3.290.0030.01116.31
7.3.280.0100.00916.31
7.3.270.0080.01917.40
7.3.260.0120.00818.24
7.3.250.0120.00516.45
7.3.240.0040.01216.24
7.3.230.0030.01316.41
7.3.210.0100.00716.31
7.3.200.0120.00619.39
7.3.190.0170.00616.61
7.3.180.0100.00616.57
7.3.170.0100.00516.61
7.3.160.0050.01116.72
7.2.330.0230.02316.69
7.2.320.0030.01416.56
7.2.310.0060.01616.45
7.2.300.0110.00616.70
7.2.290.0120.00416.58
7.2.00.0030.01619.38
7.1.200.0090.00315.74
7.1.100.0090.00618.11
7.1.70.0030.01016.94
7.1.60.0070.01019.24
7.1.50.0070.01716.45
7.1.00.0000.04322.33
7.0.200.0050.00316.56
7.0.140.0070.07322.16
7.0.100.0130.07020.22
7.0.90.0130.04319.91
7.0.80.0300.08020.04
7.0.70.0300.07719.98
7.0.60.0070.06320.03
7.0.50.0070.08320.44
7.0.40.0030.08320.18
7.0.30.0030.09019.93
7.0.20.0030.08320.08
7.0.10.0030.07320.02
7.0.00.0130.07020.05
5.6.280.0000.07321.11
5.6.250.0070.08320.63
5.6.240.0000.05720.67
5.6.230.0130.06020.60
5.6.220.0100.07720.65
5.6.210.0170.06020.78
5.6.200.0030.06721.14
5.6.190.0070.06021.14
5.6.180.0100.07021.07
5.6.170.0100.08321.07
5.6.160.0030.05321.08
5.6.150.0130.08020.99
5.6.140.0070.08321.01
5.6.130.0070.05720.98
5.6.120.0100.07721.13
5.6.110.0070.07721.04
5.6.100.0170.06721.08
5.6.90.0030.05721.07
5.6.80.0070.05720.59
5.6.70.0130.05720.47
5.6.60.0130.06320.47
5.6.50.0100.04020.48
5.6.40.0030.07020.34
5.6.30.0100.08020.34
5.6.20.0100.07320.32
5.6.10.0170.07320.50
5.6.00.0000.05320.41
5.5.380.0030.08020.40
5.5.370.0030.07720.48
5.5.360.0030.07020.38
5.5.350.0100.08720.48
5.5.340.0100.04720.93
5.5.330.0270.06320.85
5.5.320.0070.04020.85
5.5.310.0130.04320.88
5.5.300.0100.08020.93
5.5.290.0130.07720.93
5.5.280.0030.04720.91
5.5.270.0130.06720.89
5.5.260.0070.07020.88
5.5.250.0070.07020.73
5.5.240.0070.08020.25
5.5.230.0100.06020.32
5.5.220.0070.07720.28
5.5.210.0030.08320.34
5.5.200.0200.07020.25
5.5.190.0100.08020.30
5.5.180.0130.06320.15
5.5.160.0000.04720.15
5.5.150.0100.04720.25
5.5.140.0030.07020.12
5.5.130.0000.08720.23
5.5.120.0070.05020.02
5.5.110.0170.07320.18
5.5.100.0070.07720.02
5.5.90.0130.06720.11
5.5.80.0000.06020.05
5.5.70.0200.06020.10
5.5.60.0030.04019.97
5.5.50.0070.07720.18
5.5.40.0070.07720.14
5.5.30.0030.05019.95
5.5.20.0030.04320.18
5.5.10.0070.07020.07
5.5.00.0130.06020.07
5.4.450.0070.04719.20
5.4.440.0130.07019.36
5.4.430.0070.07319.44
5.4.420.0030.08019.55
5.4.410.0100.07319.23
5.4.400.0030.06019.11
5.4.390.0130.04719.23
5.4.380.0030.07019.03
5.4.370.0100.07019.18
5.4.360.0030.04319.03
5.4.350.0100.06019.18
5.4.340.0030.08319.14
5.4.320.0070.08319.13
5.4.310.0030.07318.88
5.4.300.0030.08018.95
5.4.290.0100.06019.04
5.4.280.0070.06019.18
5.4.270.0030.07718.88
5.4.260.0130.04019.13
5.4.250.0070.06018.89
5.4.240.0030.07718.89
5.4.230.0100.06719.13
5.4.220.0070.05319.04
5.4.210.0070.07718.94
5.4.200.0070.07018.87
5.4.190.0070.07318.86
5.4.180.0070.07019.08
5.4.170.0070.05019.04
5.4.160.0030.05019.11
5.4.150.0070.06318.93
5.4.140.0130.06316.43
5.4.130.0100.05716.43
5.4.120.0100.05716.26
5.4.110.0000.04716.35
5.4.100.0130.05016.38
5.4.90.0030.03716.42
5.4.80.0070.06716.39
5.4.70.0100.06716.30
5.4.60.0030.06016.50
5.4.50.0100.07016.48
5.4.40.0070.07716.38
5.4.30.0000.06316.33
5.4.20.0070.07316.36
5.4.10.0100.07016.45
5.4.00.0030.07315.90
5.3.290.0100.08014.70
5.3.280.0030.08014.63
5.3.270.0030.06314.59
5.3.260.0000.05014.63
5.3.250.0030.06314.63
5.3.240.0000.04714.58
5.3.230.0070.07714.60
5.3.220.0070.06314.66
5.3.210.0030.05314.75
5.3.200.0130.05714.63
5.3.190.0100.05314.61
5.3.180.0070.07714.70
5.3.170.0130.06714.68
5.3.160.0070.06314.63
5.3.150.0030.06714.62
5.3.140.0130.05014.56
5.3.130.0070.05014.62
5.3.120.0100.04314.63
5.3.110.0000.08314.66
5.3.100.0100.06714.07
5.3.90.0030.06714.02
5.3.80.0130.07314.07
5.3.70.0070.07314.09
5.3.60.0130.06714.16
5.3.50.0070.07714.11
5.3.40.0070.07314.06
5.3.30.0100.06713.89
5.3.20.0070.07013.79
5.3.10.0130.06713.68
5.3.00.0100.07013.75

preferences:
36.09 ms | 401 KiB | 5 Q