3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fruit = array(); $fruit[] = array('id' => 1, 'name' => 'Banana 1', 'pieces' => get_pieces(1)); $fruit[] = array('id' => 1, 'name' => 'Pear 1', 'pieces' => get_pieces(1)); $fruit[] = array('id' => 1, 'name' => 'Mango 1', 'pieces' => get_pieces(1)); $fruit[] = array('id' => 2, 'name' => 'Banana 2', 'pieces' => get_pieces(2)); $fruit[] = array('id' => 2, 'name' => 'Pear 2', 'pieces' => get_pieces(2)); $fruit[] = array('id' => 2, 'name' => 'Mango 2', 'pieces' => get_pieces(2)); function get_pieces($id) { $pieces = array(); switch ($id) { case 1: $pieces[] = array('number' => 1); $pieces[] = array('number' => 2); break; case 2: $pieces[] = array('number' => 3); $pieces[] = array('number' => 4, 'qwerty' => 1); break; } return $pieces; } print json_encode(array('fruit' => $fruit));

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.130.0040.00418.52
8.3.120.0070.00718.79
8.3.110.0040.00416.50
8.3.100.0050.00324.06
8.3.90.0130.00626.77
8.3.80.0000.00918.43
8.3.70.0110.00416.74
8.3.60.0130.00318.40
8.3.50.0160.00918.23
8.3.40.0120.00318.65
8.3.30.0100.00618.80
8.3.20.0030.00621.90
8.3.10.0080.00021.93
8.3.00.0040.00421.77
8.2.250.0080.00017.13
8.2.240.0060.00318.96
8.2.230.0060.00320.94
8.2.220.0060.00337.54
8.2.210.0120.00626.77
8.2.200.0030.00716.63
8.2.190.0130.00918.39
8.2.180.0110.01116.50
8.2.170.0060.00919.04
8.2.160.0080.00819.08
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0000.00720.79
8.2.110.0070.00422.20
8.2.100.0040.00818.34
8.2.90.0030.00522.34
8.2.80.0040.00417.97
8.2.70.0000.00918.05
8.2.60.0040.00418.22
8.2.50.0060.00318.28
8.2.40.0040.00420.58
8.2.30.0040.00419.35
8.2.20.0000.00718.14
8.2.10.0040.00418.09
8.2.00.0070.00018.08
8.1.300.0080.00018.80
8.1.290.0090.00030.84
8.1.280.0070.01425.92
8.1.270.0070.00022.14
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0100.00022.14
8.1.230.0070.00319.00
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0000.00817.23
8.1.190.0060.00317.23
8.1.180.0040.00418.10
8.1.170.0030.00518.59
8.1.160.0040.00418.79
8.1.150.0040.00418.96
8.1.140.0040.00418.98
8.1.130.0000.00717.64
8.1.120.0000.00717.43
8.1.110.0000.00817.32
8.1.100.0070.00017.34
8.1.90.0000.00717.50
8.1.80.0070.00017.49
8.1.70.0030.00317.48
8.1.60.0030.00717.52
8.1.50.0040.00417.41
8.1.40.0070.00017.54
8.1.30.0050.00317.64
8.1.20.0040.00417.72
8.1.10.0080.00017.44
8.1.00.0040.00417.52
8.0.300.0040.00419.73
8.0.290.0030.00616.75
8.0.280.0000.00718.38
8.0.270.0020.00516.78
8.0.260.0070.00017.33
8.0.250.0000.00717.05
8.0.240.0070.00016.86
8.0.230.0040.00416.95
8.0.220.0050.00316.86
8.0.210.0040.00416.82
8.0.200.0000.00616.94
8.0.190.0000.00816.90
8.0.180.0050.00516.90
8.0.170.0000.00916.89
8.0.160.0000.00816.91
8.0.150.0070.00016.77
8.0.140.0040.00416.80
8.0.130.0030.00313.29
8.0.120.0080.00016.83
8.0.110.0050.00216.83
8.0.100.0040.00416.73
8.0.90.0030.00516.91
8.0.80.0070.01016.80
8.0.70.0150.00616.84
8.0.60.0150.00416.89
8.0.50.0130.00416.79
8.0.30.0080.00917.06
8.0.20.0130.00917.34
8.0.10.0000.01416.98
8.0.00.0100.00917.01
7.4.330.0030.00315.55
7.4.320.0000.00616.54
7.4.300.0030.00316.65
7.4.290.0000.00716.57
7.4.280.0000.00816.59
7.4.270.0030.00316.66
7.4.260.0000.00716.43
7.4.250.0000.00716.39
7.4.240.0070.00016.64
7.4.230.0000.00816.72
7.4.220.0000.00916.70
7.4.210.0110.00416.40
7.4.200.0160.00016.52
7.4.190.0030.01416.71
7.4.180.0080.00816.53
7.4.160.0080.01016.63
7.4.150.0090.00817.06
7.4.140.0100.00817.55
7.4.130.0050.01116.51
7.4.120.0090.00916.48
7.4.110.0030.01516.50
7.4.100.0080.00816.48
7.4.90.0100.00516.44
7.4.80.0110.00518.03
7.4.70.0100.00716.56
7.4.60.0110.00516.44
7.4.50.0110.00516.53
7.4.40.0150.00316.48
7.4.30.0030.01116.41
7.4.20.0090.00616.43
7.4.10.0120.00415.59
7.4.00.0060.01015.29
7.3.330.0000.00513.22
7.3.320.0060.00013.21
7.3.310.0080.00016.41
7.3.300.0030.00316.41
7.3.290.0110.00516.37
7.3.280.0070.00716.38
7.3.270.0100.00616.89
7.3.260.0100.00616.49
7.3.250.0050.01116.42
7.3.240.0130.00716.43
7.3.230.0070.00816.53
7.3.220.0060.00616.29
7.3.210.0070.00816.50
7.3.200.0060.00916.28
7.3.190.0070.00916.43
7.3.180.0070.00816.49
7.3.170.0090.00716.36
7.3.160.0070.01116.48
7.3.150.0140.00016.30
7.3.140.0030.01016.33
7.3.130.0050.01115.60
7.3.120.0120.00515.44
7.3.110.0060.01115.27
7.3.100.0090.00615.25
7.3.90.0050.01015.44
7.3.80.0060.00715.36
7.3.70.0050.00815.28
7.3.60.0030.01115.47
7.3.50.0090.00415.40
7.3.40.0090.00515.49
7.3.30.0080.00715.38
7.3.20.0100.00416.57
7.3.10.0120.00516.50
7.3.00.0070.01016.55
7.2.340.0200.01216.48
7.2.330.0180.00616.61
7.2.320.0160.01116.71
7.2.310.0170.00916.71
7.2.300.0170.00816.61
7.2.290.0130.00916.65
7.2.280.0190.00716.45
7.2.270.0230.01016.52
7.2.260.0090.01815.85
7.2.250.0140.00715.56
7.2.240.0080.01315.60
7.2.230.0120.00815.61
7.2.220.0100.01015.68
7.2.210.0080.00915.53
7.2.200.0080.00815.45
7.2.190.0120.00715.65
7.2.180.0100.00915.61
7.2.170.0160.00315.66
7.2.160.0170.00115.81
7.2.150.0150.00616.94
7.2.140.0110.00916.89
7.2.130.0150.00816.74
7.2.120.0120.01116.80
7.2.110.0130.00816.78
7.2.100.0140.00616.71
7.2.90.0120.00616.74
7.2.80.0100.01216.60
7.2.70.0170.00716.81
7.2.60.0100.00816.77
7.2.50.0090.00716.81
7.2.40.0120.00716.82
7.2.30.0140.00716.76
7.2.20.0150.00716.88
7.2.10.0130.00716.75
7.2.00.0170.00717.14
7.1.330.0100.00815.75
7.1.320.0090.00915.65
7.1.310.0160.00715.68
7.1.300.0110.00515.72
7.1.290.0090.00515.68
7.1.280.0090.00815.67
7.1.270.0540.00815.75
7.1.260.0050.01115.82
7.1.250.0080.00815.62
7.1.240.0120.00915.63
7.1.230.0120.00615.47
7.1.220.0080.01015.75
7.1.210.0060.01115.52
7.1.200.0110.00415.68
7.1.190.0110.00915.46
7.1.180.0070.01315.51
7.1.170.0130.00515.68
7.1.160.0140.00715.61
7.1.150.0120.00815.71
7.1.140.0130.00815.54
7.1.130.0110.00815.63
7.1.120.0170.01115.92
7.1.110.0140.01015.82
7.1.100.0160.00715.75
7.1.90.0160.01015.57
7.1.80.0170.00915.78
7.1.70.0180.01115.51
7.1.60.0260.00821.61
7.1.50.0680.00821.40
7.1.40.0220.01321.34
7.1.30.0280.00721.34
7.1.20.0290.00921.34
7.1.10.0140.01015.34
7.1.00.0160.01015.25
7.0.330.0100.00615.30
7.0.320.0110.01115.31
7.0.310.0080.01015.24
7.0.300.0070.01215.34
7.0.290.0100.00915.29
7.0.280.0130.00815.29
7.0.270.0110.01015.14
7.0.260.0120.00815.27
7.0.250.0110.00915.33
7.0.240.0120.00515.41
7.0.230.0090.01015.44
7.0.220.0060.01315.38
7.0.210.0170.00215.33
7.0.200.0130.00615.44
7.0.190.0130.00515.36
7.0.180.0120.00715.34
7.0.170.0540.01015.47
7.0.160.0110.00915.31
7.0.150.0150.00415.41
7.0.140.0130.00815.40
7.0.130.0120.00815.42
7.0.120.0120.00615.40
7.0.110.0120.00815.34
7.0.100.0100.00715.46
7.0.90.0130.00615.26
7.0.80.0080.00915.40
7.0.70.0070.00815.42
7.0.60.0050.01415.28
7.0.50.0060.01215.34
7.0.40.0110.01114.31
7.0.30.0090.01114.38
7.0.20.0090.00914.30
7.0.10.0090.01014.31
7.0.00.0120.00614.17
5.6.400.0100.00815.14
5.6.390.0060.01315.09
5.6.380.0160.00315.39
5.6.370.0120.00415.16
5.6.360.0090.00915.36
5.6.350.0090.00615.13
5.6.340.0130.00515.25
5.6.330.0130.00715.01
5.6.320.0100.00615.13
5.6.310.0140.00715.31
5.6.300.0140.00915.18
5.6.290.0110.00815.21
5.6.280.0070.01015.24
5.6.270.0090.00915.19
5.6.260.0140.00115.08
5.6.250.0110.01315.10
5.6.240.0100.01215.25
5.6.230.0170.00715.20
5.6.220.0120.00715.33
5.6.210.0100.00715.29
5.6.200.0080.01315.26
5.6.190.0120.00915.14
5.6.180.0080.01015.23
5.6.170.0140.00515.42
5.6.160.0120.00915.27
5.6.150.0110.00915.33
5.6.140.0090.00915.23
5.6.130.0090.01015.31
5.6.120.0190.00815.33
5.6.110.0130.00715.19
5.6.100.0150.00515.14
5.6.90.0140.00515.22
5.6.80.0090.00815.19
5.6.70.0130.00215.28
5.6.60.0110.00715.38
5.6.50.0110.00915.09
5.6.40.0110.00715.29
5.6.30.0060.01115.11
5.6.20.0090.00915.06
5.6.10.0110.00815.14
5.6.00.0070.01014.98

preferences:
29.67 ms | 403 KiB | 5 Q