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.40.0090.01218.98
8.3.30.0030.01020.07
8.3.20.0040.01118.64
8.3.10.0070.00020.86
8.3.00.0070.00719.68
8.2.170.0090.00622.96
8.2.160.0030.01020.35
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00719.72
8.2.110.0060.00320.52
8.2.100.0110.00018.03
8.2.90.0040.00419.09
8.2.80.0110.00017.97
8.2.70.0050.00317.59
8.2.60.0070.00317.79
8.2.50.0090.00018.07
8.2.40.0090.00019.28
8.2.30.0080.00021.27
8.2.20.0000.00817.85
8.2.10.0050.00317.89
8.2.00.0040.00417.71
8.1.270.0060.00323.99
8.1.260.0050.00326.35
8.1.250.0120.00628.09
8.1.240.0060.00322.14
8.1.230.0080.00419.03
8.1.220.0000.00817.89
8.1.210.0050.00318.77
8.1.200.0060.00317.47
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.48
8.1.160.0000.00818.99
8.1.150.0000.00818.58
8.1.140.0040.00417.39
8.1.130.0000.00717.75
8.1.120.0100.00017.44
8.1.110.0000.00717.47
8.1.100.0000.00717.36
8.1.90.0000.00717.48
8.1.80.0040.00417.38
8.1.70.0050.00317.43
8.1.60.0040.00417.59
8.1.50.0020.00517.46
8.1.40.0040.00417.42
8.1.30.0000.00817.66
8.1.20.0000.00817.63
8.1.10.0040.00417.61
8.1.00.0000.00717.36
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0040.00418.38
8.0.270.0000.00717.32
8.0.260.0030.00516.77
8.0.250.0060.00317.00
8.0.240.0030.00817.03
8.0.230.0050.00217.02
8.0.220.0030.00316.93
8.0.210.0040.00416.91
8.0.200.0030.00316.89
8.0.190.0030.00617.02
8.0.180.0080.00016.96
8.0.170.0000.00816.91
8.0.160.0070.00016.92
8.0.150.0040.00416.80
8.0.140.0040.00416.78
8.0.130.0000.00513.38
8.0.120.0040.00416.89
8.0.110.0040.00416.82
8.0.100.0030.00616.98
8.0.90.0030.00516.85
8.0.80.0090.01316.92
8.0.70.0040.00416.80
8.0.60.0040.00416.99
8.0.50.0050.00316.85
8.0.30.0090.01217.10
8.0.20.0110.01217.40
8.0.10.0000.00717.06
8.0.00.0090.01216.79
7.4.330.0000.00616.73
7.4.320.0030.00316.53
7.4.300.0030.00316.61
7.4.290.0000.00716.49
7.4.280.0080.00016.42
7.4.270.0000.00716.60
7.4.260.0050.00013.29
7.4.250.0000.00816.41
7.4.240.0060.00316.49
7.4.230.0000.00716.62
7.4.220.0090.01616.45
7.4.210.0060.00816.46
7.4.200.0070.00016.40
7.4.190.0030.00316.47
7.4.160.0060.00916.54
7.4.150.0110.00717.40
7.4.140.0120.00517.86
7.4.130.0070.01416.65
7.4.120.0120.00716.42
7.4.110.0090.00916.61
7.4.100.0130.00316.59
7.4.90.0060.01616.54
7.4.80.0090.00919.39
7.4.70.0120.00616.66
7.4.60.0090.00916.44
7.4.50.0090.00016.50
7.4.40.0060.00622.77
7.4.30.0070.01116.46
7.4.10.0060.01216.74
7.4.00.0110.01016.60
7.3.330.0030.00313.38
7.3.320.0000.00513.18
7.3.310.0000.00716.35
7.3.300.0060.00016.27
7.3.290.0100.01016.30
7.3.280.0070.01016.33
7.3.270.0090.01317.40
7.3.260.0100.01218.24
7.3.250.0080.01216.33
7.3.240.0100.00616.56
7.3.230.0130.00416.39
7.3.210.0130.00316.38
7.3.200.0130.00319.39
7.3.190.0060.01216.53
7.3.180.0030.01316.34
7.3.170.0090.00616.28
7.3.160.0060.01016.14
7.3.130.0070.01316.32
7.3.120.0140.00716.18
7.3.110.0040.01116.25
7.3.100.0100.00716.38
7.3.90.0070.01015.96
7.3.80.0030.01016.33
7.3.70.0060.00916.37
7.3.60.0100.00716.16
7.3.50.0000.01116.33
7.3.40.0040.00816.19
7.3.30.0030.01216.34
7.3.20.0000.01118.06
7.3.10.0060.00916.97
7.3.00.0030.00916.91
7.2.330.0060.01216.55
7.2.320.0000.01716.67
7.2.310.0130.00816.62
7.2.300.0060.00916.34
7.2.290.0130.00316.68
7.2.260.0060.01316.27
7.2.250.0040.01616.61
7.2.240.0040.01216.34
7.2.230.0040.00716.48
7.2.220.0070.00716.64
7.2.210.0090.00916.54
7.2.200.0030.00716.45
7.2.190.0080.00616.61
7.2.180.0070.00716.35
7.2.170.0080.00816.55
7.2.160.0080.00316.42
7.2.150.0100.00318.42
7.2.140.0110.00718.21
7.2.130.0080.00817.23
7.2.120.0060.00717.16
7.2.110.0050.01117.05
7.2.100.0070.00817.13
7.2.90.0030.00917.14
7.2.80.0060.00817.19
7.2.70.0040.01117.11
7.2.60.0090.00717.02
7.2.50.0090.00817.14
7.2.40.0070.00617.14
7.2.30.0080.00717.11
7.2.20.0050.00717.19
7.2.10.0050.00817.18
7.2.00.0070.00917.58
7.1.330.0070.00717.12
7.1.320.0000.01317.56
7.1.310.0030.00817.34
7.1.300.0040.01117.22
7.1.290.0000.01517.24
7.1.280.0110.00317.29
7.1.270.0070.00717.09
7.1.260.0040.01117.43
7.1.250.0060.00915.77
7.1.240.0040.01517.46
7.1.230.0040.01417.34
7.1.220.0000.01717.20
7.1.210.0060.00917.15
7.1.200.0070.00717.08
7.1.190.0070.01417.29
7.1.180.0070.01317.19
7.1.170.0000.01816.98
7.1.160.0060.00917.37
7.1.150.0030.01317.15
7.1.140.0040.00417.05
7.1.130.0060.00617.20
7.1.120.0100.00317.26
7.1.110.0060.00917.15
7.1.100.0020.01017.54
7.1.90.0120.00317.16
7.1.80.0070.01117.27
7.1.70.0070.00717.15
7.1.60.0020.01118.35
7.1.50.0050.01016.80
7.1.40.0120.00617.21
7.1.30.0090.00317.18
7.1.20.0090.00617.37
7.1.10.0070.01117.11
7.1.00.0020.02319.79
7.0.330.0110.00716.64
7.0.320.0040.00816.72
7.0.310.0000.01216.84
7.0.300.0040.00816.87
7.0.290.0050.00516.95
7.0.280.0070.00717.01
7.0.270.0090.00316.88
7.0.260.0100.00316.81
7.0.250.0060.00916.84
7.0.240.0030.01016.80
7.0.230.0070.00717.11
7.0.220.0040.01116.96
7.0.210.0030.01416.82
7.0.200.0060.00516.90
7.0.190.0090.00616.83
7.0.180.0060.00616.93
7.0.170.0060.01217.13
7.0.160.0120.00417.06
7.0.150.0030.01416.91
7.0.140.0080.03719.57
7.0.130.0100.00316.63
7.0.120.0070.00716.88
7.0.110.0060.00616.86
7.0.100.0080.02718.38
7.0.90.0120.04318.38
7.0.80.0070.02318.49
7.0.70.0050.02418.45
7.0.60.0010.02618.49
7.0.50.0070.02818.64
7.0.40.0050.02317.43
7.0.30.0030.02517.43
7.0.20.0020.02717.39
7.0.10.0060.02317.53
7.0.00.0020.02817.38
5.6.400.0040.01415.86
5.6.390.0070.00416.14
5.6.380.0000.01015.93
5.6.370.0090.00915.96
5.6.360.0040.00816.10
5.6.350.0030.01315.91
5.6.340.0000.01415.90
5.6.330.0060.00616.00
5.6.320.0030.01216.06
5.6.310.0000.01215.64
5.6.300.0090.00915.94
5.6.290.0000.01415.67
5.6.280.0020.04418.53
5.6.270.0040.00815.88
5.6.260.0070.00715.80
5.6.250.0120.02218.36
5.6.240.0070.04418.15
5.6.230.0100.04218.30
5.6.220.0090.03218.39
5.6.210.0070.02718.18
5.6.200.0060.02418.44
5.6.190.0030.02318.44
5.6.180.0070.02218.48
5.6.170.0070.02518.37
5.6.160.0080.01818.43
5.6.150.0070.02718.47
5.6.140.0090.02018.38
5.6.130.0080.02318.52
5.6.120.0030.02518.36
5.6.110.0070.02018.46
5.6.100.0000.02618.46
5.6.90.0090.02018.43
5.6.80.0000.02718.10
5.6.70.0050.02018.06
5.6.60.0030.02318.11
5.6.50.0030.02117.88
5.6.40.0050.02118.16
5.6.30.0050.03017.96
5.6.20.0070.04318.03
5.6.10.0090.03018.09
5.6.00.0100.03818.02
5.5.380.0020.03118.03
5.5.370.0080.04118.04
5.5.360.0050.02618.02
5.5.350.0030.03318.08
5.5.340.0030.02318.20
5.5.330.0060.03618.38
5.5.320.0020.02518.33
5.5.310.0070.02018.38
5.5.300.0100.01818.45
5.5.290.0050.02218.28
5.5.280.0080.02218.33
5.5.270.0080.02218.20
5.5.260.0110.02318.12
5.5.250.0080.01718.18
5.5.240.0060.02018.07
5.5.230.0080.01617.95
5.5.220.0030.02317.85
5.5.210.0030.02117.98
5.5.200.0100.01718.04
5.5.190.0070.04217.93
5.5.180.0080.04018.03
5.5.170.0060.00615.63
5.5.160.0080.04317.87
5.5.150.0060.04217.91
5.5.140.0140.03517.75
5.5.130.0120.03717.93
5.5.120.0050.03717.91
5.5.110.0080.03717.93
5.5.100.0040.04417.79
5.5.90.0070.03217.87
5.5.80.0070.02217.91
5.5.70.0080.04217.89
5.5.60.0050.04517.77
5.5.50.0130.03617.69
5.5.40.0130.03817.84
5.5.30.0060.04517.80
5.5.20.0070.02717.84
5.5.10.0080.02617.81
5.5.00.0030.02517.85
5.4.450.0050.02615.98
5.4.440.0030.02515.98
5.4.430.0030.02316.00
5.4.420.0050.02315.93
5.4.410.0050.02616.07
5.4.400.0020.02715.78
5.4.390.0020.02315.69
5.4.380.0030.02415.69
5.4.370.0070.01715.60
5.4.360.0060.02615.63
5.4.350.0100.03015.78
5.4.340.0060.03815.74
5.4.330.0030.01212.52
5.4.320.0110.03315.61
5.4.310.0050.02015.62
5.4.300.0040.02315.79
5.4.290.0100.03715.61
5.4.280.0040.02215.77
5.4.270.0100.03515.88
5.4.260.0020.02915.61
5.4.250.0050.02315.77
5.4.240.0000.02415.82
5.4.230.0050.03315.78
5.4.220.0050.04115.56
5.4.210.0020.02915.62
5.4.200.0070.03815.65
5.4.190.0070.02615.80
5.4.180.0070.04015.76
5.4.170.0000.02515.96
5.4.160.0070.03215.84
5.4.150.0100.03215.72
5.4.140.0050.04514.45
5.4.130.0050.03614.45
5.4.120.0090.03214.42
5.4.110.0150.03314.58
5.4.100.0080.03914.42
5.4.90.0050.04014.38
5.4.80.0060.02014.36
5.4.70.0080.03514.59
5.4.60.0050.04014.41
5.4.50.0060.03814.57
5.4.40.0030.03814.54
5.4.30.0080.03714.51
5.4.20.0050.03514.39
5.4.10.0050.02314.50
5.4.00.0040.03714.25
5.3.290.0090.04214.41
5.3.280.0100.03814.35
5.3.270.0020.02814.38
5.3.260.0070.03914.39
5.3.250.0050.03014.38
5.3.240.0050.04714.36
5.3.230.0050.03814.35
5.3.220.0050.03014.29
5.3.210.0070.03814.35
5.3.200.0070.04014.37
5.3.190.0100.03814.38
5.3.180.0030.02614.38
5.3.170.0030.04414.32
5.3.160.0030.02414.45
5.3.150.0060.03814.38
5.3.140.0050.04114.39
5.3.130.0070.04014.41
5.3.120.0120.01814.42
5.3.110.0090.03414.39
5.3.100.0020.04614.31
5.3.90.0070.02514.41
5.3.80.0030.02814.23
5.3.70.0070.03814.28
5.3.60.0020.04014.37
5.3.50.0020.03814.30
5.3.40.0060.02614.31
5.3.30.0070.02714.32
5.3.20.0030.04514.36
5.3.10.0050.02814.23
5.3.00.0080.03914.18

preferences:
53.66 ms | 400 KiB | 5 Q