3v4l.org

run code in 300+ PHP versions simultaneously
<?php function newRememberMeCookie($id) { // generate 64 char random string and store it in current user data $random_token_string = hash('sha256', mt_rand()); $sql = "INSERT INTO lib_usercookies(user_id, user_cookies) VALUES (:user_id, :user_cookies)"; $stmt = $this->_db_connection->prepare($sql); $stmt->bindValue(':user_id', $id, PDO::PARAM_INT); $stmt->bindValue(':user_cookies', $random_token_string, PDO::PARAM_STR); $stmt->execute(); // generate cookie string that consists of userid, randomstring and combined hash of both $cookie_string_first_part = $random_token_string; $cookie_string_hash = hash_hmac('sha1', $cookie_string_first_part, "1gp@TMPS{+$78sfpMJFe-92s"); $cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash; // set cookie setcookie('cri1432', $cookie_string, (time() + 60 * 60 * 24), '/', ".127.0.0.1"); } var_dump(newRememberMeCookie(1));

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)
7.4.10.0070.01014.81
7.4.00.0040.01215.09
7.3.130.0110.00314.83
7.3.120.0140.00315.00
7.3.110.0060.00914.79
7.3.100.0090.00615.00
7.3.90.0000.01214.84
7.3.80.0040.00814.44
7.3.70.0030.00614.78
7.3.60.0080.00614.54
7.3.50.0030.01014.93
7.3.40.0040.01114.84
7.3.30.0090.00414.47
7.3.20.0060.01016.58
7.3.10.0030.01016.62
7.3.00.0050.00716.41
7.2.260.0110.00314.82
7.2.250.0070.01015.14
7.2.240.0060.00915.08
7.2.230.0070.00715.16
7.2.220.0060.01015.31
7.2.210.0000.01415.31
7.2.200.0100.00714.95
7.2.190.0030.01314.81
7.2.180.0070.00314.74
7.2.170.0070.01015.02
7.2.160.0000.01714.77
7.2.150.0060.00916.82
7.2.140.0000.01616.86
7.2.130.0050.01016.84
7.2.120.0070.00516.79
7.2.110.0080.00616.88
7.2.100.0070.00816.66
7.2.90.0050.00616.71
7.2.80.0100.00517.01
7.2.70.0070.01017.05
7.2.60.0080.00716.84
7.2.50.0070.00916.84
7.2.40.0020.01416.78
7.2.30.0090.00817.01
7.2.20.0030.01016.81
7.2.10.0060.00516.89
7.2.00.0090.00417.74
7.1.330.0080.00815.74
7.1.320.0030.01415.75
7.1.310.0050.00515.40
7.1.300.0040.00415.36
7.1.290.0080.00015.69
7.1.280.0030.01015.35
7.1.270.0060.00315.50
7.1.260.0090.00615.51
7.1.250.0100.00315.64
7.1.240.0070.00515.68
7.1.230.0030.01015.66
7.1.220.0100.00315.72
7.1.210.0070.00615.58
7.1.200.0060.00615.76
7.1.190.0080.00715.45
7.1.180.0030.01215.64
7.1.170.0030.01315.78
7.1.160.0040.00715.59
7.1.150.0050.00715.52
7.1.140.0030.00915.59
7.1.130.0050.00815.68
7.1.120.0000.01015.71
7.1.110.0110.00215.62
7.1.100.0050.00815.64
7.1.90.0070.00715.53
7.1.80.0100.00515.69
7.1.70.0070.00316.24
7.1.60.0070.01117.03
7.1.50.0060.00416.06
7.1.40.0050.01015.77
7.1.30.0070.00715.50
7.1.20.0110.00515.66
7.1.10.0110.00615.75
7.1.00.0030.03217.95
7.0.330.0060.00515.17
7.0.320.0030.00615.38
7.0.310.0040.01015.34
7.0.300.0030.01115.31
7.0.290.0050.00715.17
7.0.280.0040.00915.27
7.0.270.0030.01015.47
7.0.260.0080.00315.17
7.0.250.0050.01115.36
7.0.240.0050.00915.37
7.0.230.0030.01015.27
7.0.220.0050.00815.39
7.0.210.0090.00515.24
7.0.200.0080.00315.67
7.0.190.0110.00315.19
7.0.180.0090.00215.16
7.0.170.0070.00415.29
7.0.160.0100.00315.24
7.0.150.0070.00715.23
7.0.140.0060.02717.45
7.0.130.0050.00915.22
7.0.120.0050.00715.45
7.0.110.0030.01015.34
7.0.100.0030.00715.37
7.0.90.0030.00715.41
7.0.80.0020.03017.41
7.0.70.0070.02717.47
7.0.60.0060.01817.40
7.0.50.0040.03317.50
7.0.40.0080.03115.61
7.0.30.0030.03515.60
7.0.20.0080.03115.56
7.0.10.0050.02615.46
7.0.00.0040.03615.54
5.6.400.0040.01113.98
5.6.390.0100.00314.44
5.6.380.0070.00814.27
5.6.370.0060.00714.25
5.6.360.0070.00614.31
5.6.350.0030.01014.25
5.6.340.0020.01114.48
5.6.330.0040.00714.13
5.6.320.0050.00914.22
5.6.310.0030.01214.42
5.6.300.0060.00714.06
5.6.290.0030.01114.25
5.6.280.0070.02816.55
5.6.270.0040.00714.08
5.6.260.0080.00614.47
5.6.250.0050.00814.26
5.6.240.0050.00614.08
5.6.230.0060.02816.43
5.6.220.0040.03216.28
5.6.210.0050.02216.37
5.6.200.0030.03616.38
5.6.190.0090.03016.64
5.6.180.0040.02116.43
5.6.170.0130.02716.52
5.6.160.0080.02616.37
5.6.150.0070.03116.37
5.6.140.0030.03016.38
5.6.130.0020.03416.46
5.6.120.0080.03116.53
5.6.110.0070.02216.53
5.6.100.0050.03216.30
5.6.90.0070.03516.51
5.6.80.0060.02516.32
5.6.70.0100.02716.24
5.6.60.0060.03416.21
5.6.50.0070.03216.23
5.6.40.0020.03516.21
5.6.30.0050.02816.26
5.6.20.0050.03216.09
5.6.10.0040.03016.14
5.6.00.0090.03116.19
5.5.380.0040.00812.69
5.5.370.0020.03515.37
5.5.360.0040.02415.21
5.5.350.0070.02415.16
5.5.340.0060.03515.36
5.5.330.0050.03215.30
5.5.320.0030.02015.40
5.5.310.0070.02815.38
5.5.300.0070.03115.24
5.5.290.0030.03415.47
5.5.280.0080.03115.38
5.5.270.0040.03215.34
5.5.260.0070.03215.38
5.5.250.0050.02315.20
5.5.240.0100.02915.24
5.5.230.0080.02915.11
5.5.220.0060.03215.19
5.5.210.0070.02915.20
5.5.200.0010.03415.01
5.5.190.0060.02715.18
5.5.180.0050.03315.23
5.5.170.0050.00412.68
5.5.160.0040.03115.13
5.5.150.0080.02615.17
5.5.140.0070.02415.13
5.5.130.0080.02515.15
5.5.120.0050.03115.01
5.5.110.0090.02715.22
5.5.100.0070.02815.05
5.5.90.0080.03015.07
5.5.80.0030.02915.15
5.5.70.0090.02715.13
5.5.60.0030.03315.13
5.5.50.0080.02815.04
5.5.40.0040.03314.96
5.5.30.0090.02415.01
5.5.20.0030.03115.12
5.5.10.0040.02714.97
5.5.00.0130.02515.14
5.4.450.0080.02713.99
5.4.440.0020.02713.97
5.4.430.0060.02813.87
5.4.420.0080.02213.94
5.4.410.0050.03113.90
5.4.400.0040.03013.83
5.4.390.0120.02413.80
5.4.380.0050.02813.82
5.4.370.0060.02713.87
5.4.360.0080.02713.85
5.4.350.0020.02513.83
5.4.340.0070.02413.83
5.4.330.0020.01011.22
5.4.320.0040.03113.86
5.4.310.0080.02413.76
5.4.300.0080.02713.76
5.4.290.0040.02813.90
5.4.280.0020.03013.86
5.4.270.0100.02013.82
5.4.260.0060.02913.76
5.4.250.0070.02613.76
5.4.240.0040.03013.87
5.4.230.0030.03113.83
5.4.220.0040.02113.88
5.4.210.0060.02713.77
5.4.200.0060.02613.89
5.4.190.0020.02213.82
5.4.180.0060.02813.78
5.4.170.0050.02713.90
5.4.160.0030.03013.79
5.4.150.0020.03213.82
5.4.140.0030.02912.95
5.4.130.0030.02112.96
5.4.120.0050.02712.93
5.4.110.0040.02912.92
5.4.100.0070.02412.92
5.4.90.0020.02012.97
5.4.80.0060.02112.97
5.4.70.0030.02612.98
5.4.60.0040.02012.98
5.4.50.0040.02812.93
5.4.40.0050.03212.92
5.4.30.0060.02612.97
5.4.20.0040.02712.95
5.4.10.0060.02912.95
5.4.00.0020.03012.77
5.3.290.0110.02612.36
5.3.280.0030.03012.38
5.3.270.0040.02912.33
5.3.260.0060.02712.37
5.3.250.0020.02812.36
5.3.240.0070.02712.35
5.3.230.0060.03012.37
5.3.220.0050.02712.33
5.3.210.0040.01812.37
5.3.200.0030.02612.34
5.3.190.0070.01512.31
5.3.180.0030.03112.34
5.3.170.0020.03112.31
5.3.160.0030.02812.35
5.3.150.0050.02712.34
5.3.140.0060.02412.37
5.3.130.0070.02712.35
5.3.120.0070.02912.36
5.3.110.0010.02912.34
5.3.100.0030.03112.18
5.3.90.0040.02712.20
5.3.80.0070.02212.14
5.3.70.0050.03012.13
5.3.60.0060.01812.12
5.3.50.0050.02712.14
5.3.40.0040.02512.16
5.3.30.0030.02712.11
5.3.20.0020.03112.09
5.3.10.0050.02612.02
5.3.00.0020.02712.06
5.2.170.0020.03611.39
5.2.160.0020.03611.39
5.2.150.0040.03611.39
5.2.140.0050.03011.39
5.2.130.0040.03211.39
5.2.120.0040.03311.39
5.2.110.0030.02811.39
5.2.100.0050.03011.39
5.2.90.0000.02811.39
5.2.80.0020.03611.39
5.2.70.0030.03611.39
5.2.60.0030.02611.39
5.2.50.0050.03311.39
5.2.40.0040.02411.39
5.2.30.0000.03411.39
5.2.20.0020.03311.39
5.2.10.0020.03311.39
5.2.00.0050.03011.39
5.1.60.0030.02911.39
5.1.50.0060.02811.39
5.1.40.0040.02711.39
5.1.30.0020.02911.39
5.1.20.0050.02211.39
5.1.10.0020.02811.39
5.1.00.0070.02011.39
5.0.50.0050.01611.39
5.0.40.0030.02111.39
5.0.30.0050.02811.39
5.0.20.0030.02311.39
5.0.10.0010.02011.39
5.0.00.0060.03211.39
4.4.90.0010.01411.39
4.4.80.0010.01811.39
4.4.70.0050.01311.39
4.4.60.0020.01911.39
4.4.50.0040.01611.39
4.4.40.0020.03011.39
4.4.30.0050.01511.39
4.4.20.0000.02211.39
4.4.10.0000.02011.39
4.4.00.0020.02511.39
4.3.110.0000.01511.39
4.3.100.0000.01311.39
4.3.90.0000.01911.39
4.3.80.0000.02811.39
4.3.70.0030.01811.39
4.3.60.0030.01711.39
4.3.50.0020.01911.39
4.3.40.0020.02811.39
4.3.30.0020.02011.39
4.3.20.0020.01711.39
4.3.10.0020.01911.39
4.3.00.0020.01711.39

preferences:
38.14 ms | 401 KiB | 5 Q