3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ {name: "KFC", distance: 17, likes: 3}, {name: "Macdonalds", distance: 2, likes: 9}, {name: "Pizza Hut", distance: 9, likes: 12}, {name: "Burger King", distance: 14, likes: 17} ]'; $json = preg_replace('/(\w+)(?=:)/', '"$1"', $json); $restaurants = json_decode($json, true); function get_rating($restaurant, $weights) { $rating = 0; foreach ($weights as $factor => $weight) { $rating += $weight * $restaurant[$factor]; } return $rating; } $weights = array('distance' => -30, 'likes' => 10); usort($restaurants, function ($a, $b) use ($weights) { return get_rating($b, $weights) - get_rating($a, $weights); }); print_r($restaurants);

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.4.20.0070.01019.54
8.4.10.0090.00622.37
8.3.150.0060.01320.80
8.3.140.0040.00417.27
8.3.130.0030.00616.86
8.3.120.0000.01518.90
8.3.110.0080.00020.94
8.3.100.0080.00024.06
8.3.90.0080.00026.77
8.3.80.0070.00316.75
8.3.70.0190.00316.63
8.3.60.0180.00418.43
8.3.50.0120.00524.55
8.3.40.0120.00919.09
8.3.30.0120.00319.14
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0030.00626.16
8.2.270.0180.00017.20
8.2.260.0090.00316.94
8.2.250.0030.00616.70
8.2.240.0100.01016.90
8.2.230.0120.00422.58
8.2.220.0030.00637.54
8.2.210.0060.00326.77
8.2.200.0000.00916.63
8.2.190.0070.01116.75
8.2.180.0160.00625.92
8.2.170.0040.01119.13
8.2.160.0000.01422.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00821.12
8.2.110.0000.01020.53
8.2.100.0040.00818.03
8.2.90.0030.00520.42
8.2.80.0000.00918.05
8.2.70.0000.01017.93
8.2.60.0030.00618.22
8.2.50.0040.00418.10
8.2.40.0030.00619.44
8.2.30.0000.00719.27
8.2.20.0000.00718.26
8.2.10.0000.00819.36
8.2.00.0000.00819.29
8.1.310.0070.01020.09
8.1.300.0000.00918.52
8.1.290.0030.00618.88
8.1.280.0110.00425.92
8.1.270.0040.00424.66
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00323.86
8.1.230.0030.00923.89
8.1.220.0090.00017.79
8.1.210.0000.00919.16
8.1.200.0030.00617.48
8.1.190.0040.00417.50
8.1.180.0080.00018.10
8.1.170.0040.00418.77
8.1.160.0000.00719.07
8.1.150.0000.00818.94
8.1.140.0040.00419.00
8.1.130.0030.00320.04
8.1.120.0000.00717.54
8.1.110.0050.00317.59
8.1.100.0030.00617.62
8.1.90.0070.00017.59
8.1.80.0030.00717.63
8.1.70.0000.00717.54
8.1.60.0040.00417.72
8.1.50.0050.00217.71
8.1.40.0000.00817.69
8.1.30.0000.00817.86
8.1.20.0030.00517.81
8.1.10.0050.00317.72
8.1.00.0080.00017.66
8.0.300.0040.00420.10
8.0.290.0030.00616.75
8.0.280.0000.00718.54
8.0.270.0040.00717.04
8.0.260.0000.00618.36
8.0.250.0000.00717.00
8.0.240.0050.00317.00
8.0.230.0080.00017.01
8.0.220.0030.00317.03
8.0.210.0040.00416.95
8.0.200.0040.00417.13
8.0.190.0040.00417.18
8.0.180.0030.00517.08
8.0.170.0040.00416.98
8.0.160.0040.00417.02
8.0.150.0030.00417.09
8.0.140.0080.00016.94
8.0.130.0030.00313.45
8.0.120.0000.00716.91
8.0.110.0040.00417.09
8.0.100.0000.00717.01
8.0.90.0000.00717.04
8.0.80.0080.00817.03
8.0.70.0040.00417.01
8.0.60.0040.00416.92
8.0.50.0080.00016.93
8.0.30.0180.00617.43
8.0.20.0070.01317.16
8.0.10.0040.00417.05
8.0.00.0170.01016.98
7.4.330.0000.00515.55
7.4.320.0000.00616.86
7.4.300.0030.00316.83
7.4.290.0000.00716.74
7.4.280.0050.00216.81
7.4.270.0040.00416.75
7.4.260.0030.00313.52
7.4.250.0040.00416.75
7.4.240.0000.00816.67
7.4.230.0000.00816.54
7.4.220.0030.00416.80
7.4.210.0060.00916.78
7.4.200.0000.00816.70
7.4.130.0100.00816.81
7.4.120.0150.00616.55
7.4.110.0130.00516.55
7.4.100.0060.01616.70
7.4.90.0070.01016.68
7.4.80.0080.00819.39
7.4.70.0080.01416.54
7.4.60.0100.01716.54
7.4.50.0030.01616.68
7.4.40.0120.01216.55
7.4.30.0170.00616.52
7.4.20.0160.00316.54
7.4.10.0070.01616.48
7.4.00.0130.00616.75
7.3.330.0000.00716.43
7.3.320.0030.00313.48
7.3.310.0030.00316.54
7.3.300.0070.00016.41
7.3.290.0070.00816.44
7.3.260.0070.01016.70
7.3.230.0150.01116.76
7.3.210.0070.01016.83
7.3.200.0110.00516.74
7.3.190.0100.00916.66
7.3.180.0200.00616.57
7.3.170.0110.00916.66
7.3.160.0060.01416.64
7.3.150.0200.00716.63
7.3.140.0110.00916.50
7.3.130.0160.00416.45
7.3.120.0170.01016.76
7.3.110.0160.00316.48
7.3.100.0130.00616.41
7.3.90.0080.01916.43
7.3.80.0030.02516.43
7.3.70.0090.01216.73
7.3.60.0060.01216.61
7.3.50.0210.00516.50
7.3.40.0080.01516.43
7.3.30.0060.01316.47
7.3.20.0060.01316.65
7.3.10.0080.01716.54
7.3.00.0170.00416.45
7.2.330.0130.00316.89
7.2.320.0080.00816.82
7.2.310.0110.01416.72
7.2.300.0060.01616.68
7.2.290.0070.01416.89
7.2.280.0100.01716.80
7.2.270.0080.01116.80
7.2.260.0210.00716.96
7.2.250.0280.02216.81
7.2.240.0100.01016.73
7.2.230.0170.00316.72
7.2.220.0170.00316.66
7.2.210.0120.00916.85
7.2.200.0150.00616.56
7.2.190.0180.00716.61
7.2.180.0080.01116.68
7.2.170.0060.01516.71
7.2.160.0130.01316.74
7.2.150.0110.01116.77
7.2.140.0150.00616.88
7.2.130.0160.01216.81
7.2.120.0140.00916.93
7.2.110.0070.01716.87
7.2.100.0160.00916.91
7.2.90.0080.01216.84
7.2.80.0110.01116.64
7.2.70.0130.01016.89
7.2.60.0140.01116.94
7.2.50.0130.00916.85
7.2.40.0150.00916.78
7.2.30.0280.00916.94
7.2.20.0140.01016.81
7.2.10.0150.01216.79
7.2.00.0100.01016.93

preferences:
123.8 ms | 403 KiB | 5 Q