3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cloud_usage_file = "cloudinary_usage.json"; function primary($cloud_usage_file) { if ( !file_exists($cloud_usage_file) ) { write_to_file($cloud_usage_file); } else { clean_array($cloud_usage_file); write_to_file($cloud_usage_file); } } function clean_array($cloud_usage_file) { $json_obj = json_decode(file_get_contents($cloud_usage_file), TRUE); // delete repeat / indentical entries ... // $json_obj = array_unique($json_obj); foreach ($json_obj as $key => $value) { if (is_array($value)) { if ( strtotime($value[0]) < ( time() - 43200 ) ) { unset($json_obj[$key]); } } } $clean_json = json_encode($json_obj); file_put_contents($cloud_usage_file, $clean_json); } function entry_from_curl() { $curl_url = 'https://144926223166432:x73txJkfqIlpoxB6IEeJyLLYIz8@api.cloudinary.com/v1_1/answ-cld/usage'; $json_result = file_get_contents($curl_url); $usage_array = json_decode($json_result, true); $bandwidth_limit = $usage_array['bandwidth']['limit']; $bandwidth_use = $usage_array['bandwidth']['usage']; date_default_timezone_set("America/Los_Angeles"); // PST $friendly_date = date('Y-M-d H:m:s'); $temp_array = array( $friendly_date, $bandwidth_limit, $bandwidth_use); return $temp_array; } function write_to_file($cloud_usage_file) { $file_contents = file_exists($cloud_usage_file) ? file_get_contents($cloud_usage_file) : array(); $cloud_usage_array = file_exists($cloud_usage_file) ? json_decode($file_contents, TRUE) : array(); $entry_array = entry_from_curl(); if ( !is_null($cloud_usage_array) ) { array_push($cloud_usage_array, $entry_array); } else { $cloud_usage_array = $entry_array; } $json_mega_array = json_encode($cloud_usage_array); file_put_contents( $cloud_usage_file, $json_mega_array); } primary( $cloud_usage_file ); ?>

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.0080.01115.90
7.4.00.0030.01315.78
7.3.130.0100.00715.79
7.3.120.0090.01015.85
7.3.110.0100.00515.77
7.3.100.0100.00615.70
7.3.90.0100.00715.86
7.3.80.0030.00815.91
7.3.70.0030.01115.61
7.3.60.0040.01015.71
7.3.50.0080.00915.48
7.3.40.0040.00615.75
7.3.30.0080.00715.73
7.3.20.0050.01117.56
7.3.10.0020.01117.49
7.3.00.0090.00317.68
7.2.260.0100.00715.96
7.2.250.0070.01016.03
7.2.240.0070.01015.88
7.2.230.0080.01016.19
7.2.220.0050.01016.15
7.2.210.0050.00715.92
7.2.200.0060.00815.99
7.2.190.0100.00416.03
7.2.180.0060.01015.95
7.2.170.0020.01316.04
7.2.160.0080.00815.88
7.2.150.0070.00817.77
7.2.140.0060.01117.89
7.2.130.0080.00817.70
7.2.120.0070.00917.88
7.2.110.0060.00817.71
7.2.100.0050.00617.85
7.2.90.0020.01517.79
7.2.80.0050.00917.81
7.2.70.0090.01017.85
7.2.60.0160.01017.59
7.2.50.0070.00817.82
7.2.40.0030.01217.71
7.2.30.0060.00817.83
7.2.20.0040.00817.88
7.2.10.0050.00917.88
7.2.00.0050.00818.52
7.1.330.0060.00916.77
7.1.320.0050.00516.76
7.1.310.0070.00816.75
7.1.300.0020.00816.63
7.1.290.0020.01116.72
7.1.280.0060.01016.75
7.1.270.0080.00516.85
7.1.260.0040.00816.84
7.1.250.0060.00516.80
7.1.240.0110.00316.67
7.1.230.0030.01216.77
7.1.220.0070.00716.62
7.1.210.0050.01216.66
7.1.200.0050.00816.42
7.1.190.0070.00916.71
7.1.180.0100.00516.75
7.1.170.0100.00516.77
7.1.160.0120.00316.75
7.1.150.0020.01416.66
7.1.140.0020.01016.76
7.1.130.0060.00816.66
7.1.120.0060.00516.61
7.1.110.0050.00816.83
7.1.100.0030.00816.81
7.1.90.0050.00916.77
7.1.80.0070.00516.74
7.1.70.0040.00617.01
7.1.60.0490.00516.34
7.1.50.0080.00816.99
7.1.40.0050.00716.70
7.1.30.0060.01016.64
7.1.20.0060.01016.80
7.1.10.0020.01116.77
7.1.00.0040.03118.63
7.0.330.0100.00516.25
7.0.320.0020.01016.30
7.0.310.0040.00716.37
7.0.300.0070.00716.30
7.0.290.0070.00616.39
7.0.280.0050.00816.21
7.0.270.0090.00816.32
7.0.260.0060.00616.31
7.0.250.0050.00616.27
7.0.240.0060.00616.34
7.0.230.0090.00216.36
7.0.220.0030.00816.39
7.0.210.0050.01016.31
7.0.200.0040.00916.53
7.0.190.0030.00716.21
7.0.180.0050.00816.36
7.0.170.0030.01116.41
7.0.160.0030.01016.25
7.0.150.0030.00916.29
7.0.140.0040.03018.48
7.0.130.0050.00816.35
7.0.120.0060.00516.42
7.0.110.0030.01116.40
7.0.100.0140.01917.66
7.0.90.0060.02017.70
7.0.80.0140.02717.71
7.0.70.0120.02817.66
7.0.60.0140.02617.61
7.0.50.0110.03617.76
7.0.40.0070.01816.46
7.0.30.0050.02116.31
7.0.20.0040.02716.36
7.0.10.0070.03116.32
7.0.00.0040.02316.39
5.6.400.0050.00815.51
5.6.390.0070.00715.27
5.6.380.0070.00915.36
5.6.370.0050.01015.26
5.6.360.0030.00715.32
5.6.350.0070.00715.02
5.6.340.0070.00715.13
5.6.330.0030.01115.28
5.6.320.0020.01115.28
5.6.310.0030.01015.33
5.6.300.0050.00815.20
5.6.290.0030.01015.30
5.6.280.0070.03017.28
5.6.270.0010.01415.23
5.6.260.0030.00915.19
5.6.250.0070.02817.12
5.6.240.0070.03017.04
5.6.230.0040.02317.08
5.6.220.0090.03417.08
5.6.210.0040.03817.05
5.6.200.0070.03117.35
5.6.190.0040.03017.22
5.6.180.0060.03317.28
5.6.170.0030.03317.38
5.6.160.0040.03117.15
5.6.150.0090.02917.30
5.6.140.0060.03117.45
5.6.130.0090.02917.30
5.6.120.0060.02317.29
5.6.110.0050.03317.38
5.6.100.0060.03917.30
5.6.90.0040.03117.27
5.6.80.0040.02317.07
5.6.70.0100.02917.00
5.6.60.0070.03017.10
5.6.50.0100.03017.03
5.6.40.0070.03117.15
5.6.30.0060.02116.97
5.6.20.0000.02516.98
5.6.10.0080.02917.03
5.6.00.0080.03017.07
5.5.380.0120.02116.90
5.5.370.0100.03116.91
5.5.360.0060.03517.05
5.5.350.0110.01817.05
5.5.340.0060.02317.10
5.5.330.0070.01917.16
5.5.320.0080.02417.18
5.5.310.0090.03017.11
5.5.300.0090.03017.20
5.5.290.0060.02717.21
5.5.280.0130.02317.13
5.5.270.0130.02917.05
5.5.260.0070.03317.08
5.5.250.0060.03516.94
5.5.240.0050.03116.98
5.5.230.0070.02916.93
5.5.220.0060.02616.89
5.5.210.0020.03416.96
5.5.200.0100.02916.92
5.5.190.0070.03316.65
5.5.180.0080.02016.74
5.5.170.0080.00615.11
5.5.160.0070.03116.86
5.5.150.0050.03216.97
5.5.140.0080.02916.92
5.5.130.0050.03416.86
5.5.120.0110.02016.79
5.5.110.0030.03216.98
5.5.100.0040.03216.86
5.5.90.0080.03016.97
5.5.80.0060.02316.95
5.5.70.0050.03116.68
5.5.60.0100.02816.71
5.5.50.0090.02816.88
5.5.40.0100.03016.80
5.5.30.0030.02816.80
5.5.20.0090.03016.84
5.5.10.0030.02316.67
5.5.00.0070.03016.80
5.4.450.0040.03215.06
5.4.440.0040.03315.14
5.4.430.0030.03115.13
5.4.420.0080.02515.06
5.4.410.0060.01914.98
5.4.400.0080.02615.01
5.4.390.0060.01915.05
5.4.380.0070.03014.97
5.4.370.0080.01914.95
5.4.360.0030.03215.00
5.4.350.0070.02815.00
5.4.340.0100.02615.01
5.4.330.0050.00612.80
5.4.320.0100.01415.00
5.4.310.0050.02315.02
5.4.300.0020.03014.95
5.4.290.0070.02015.01
5.4.280.0050.02714.96
5.4.270.0050.03214.95
5.4.260.0050.03314.91
5.4.250.0060.03315.02
5.4.240.0020.03514.95
5.4.230.0050.03214.99
5.4.220.0090.03215.00
5.4.210.0120.02614.96
5.4.200.0080.02014.98
5.4.190.0040.02115.02
5.4.180.0080.01714.99
5.4.170.0050.02214.96
5.4.160.0100.01614.91
5.4.150.0090.02315.02
5.4.140.0070.03114.00
5.4.130.0070.01614.02
5.4.120.0070.03014.02
5.4.110.0110.02213.99
5.4.100.0070.03114.04
5.4.90.0040.03114.03
5.4.80.0040.03714.02
5.4.70.0050.03014.02
5.4.60.0090.02613.96
5.4.50.0050.01813.96
5.4.40.0090.02813.96
5.4.30.0080.02414.02
5.4.20.0110.02314.02
5.4.10.0050.03014.00
5.4.00.0080.02413.80
5.3.290.0130.06014.69
5.3.280.0100.07014.54
5.3.270.0100.07014.74
5.3.260.0070.07014.57
5.3.250.0130.06314.55
5.3.240.0000.05314.71
5.3.230.0070.07714.55
5.3.220.0070.08014.63
5.3.210.0070.08014.59
5.3.200.0000.05014.59
5.3.190.0070.05314.70
5.3.180.0030.04314.57
5.3.170.0070.05014.54
5.3.160.0030.07014.64
5.3.150.0100.03714.71
5.3.140.0100.06714.54
5.3.130.0130.07014.57
5.3.120.0030.08014.49
5.3.110.0030.04014.49
5.3.100.0130.07014.02
5.3.90.0130.06714.15
5.3.80.0070.08014.02
5.3.70.0170.06714.06
5.3.60.0130.06714.13
5.3.50.0130.06714.04
5.3.40.0030.07714.10
5.3.30.0130.07014.00
5.3.20.0070.07013.77
5.3.10.0030.07013.60
5.3.00.0070.06313.64
5.2.170.0100.05711.22
5.2.160.0070.05311.18
5.2.150.0070.06311.18
5.2.140.0030.06311.30
5.2.130.0030.06711.21
5.2.120.0030.06711.16
5.2.110.0070.05011.03
5.2.100.0100.05311.17
5.2.90.0030.06011.21
5.2.80.0030.05311.22
5.2.70.0070.05311.16
5.2.60.0100.04711.08
5.2.50.0100.04311.15
5.2.40.0030.04310.88
5.2.30.0100.05010.88
5.2.20.0070.03311.11
5.2.10.0130.04710.88
5.2.00.0100.04010.75
5.1.60.0070.02710.37
5.1.50.0000.04710.37
5.1.40.0000.03310.37
5.1.30.0030.04710.50
5.1.20.0070.05710.37
5.1.10.0070.05010.37
5.1.00.0070.04710.37
5.0.50.0030.04710.37
5.0.40.0030.04010.37
5.0.30.0000.06310.37
5.0.20.0000.04010.37
5.0.10.0070.03710.37
5.0.00.0030.04010.37
4.4.90.0030.03710.37
4.4.80.0000.03310.37
4.4.70.0030.02010.37
4.4.60.0070.01710.37
4.4.50.0030.03010.37
4.4.40.0070.05010.37
4.4.30.0030.01310.37
4.4.20.0070.02010.37
4.4.10.0030.03710.37
4.4.00.0000.05310.37
4.3.110.0030.03310.37
4.3.100.0000.03310.37
4.3.90.0030.02310.37
4.3.80.0000.02710.37
4.3.70.0100.02310.37
4.3.60.0070.03010.37
4.3.50.0000.03010.37
4.3.40.0030.03710.37
4.3.30.0030.02310.37
4.3.20.0030.02010.37
4.3.10.0030.04010.37
4.3.00.0130.01010.37

preferences:
31.21 ms | 401 KiB | 5 Q