3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 0 => [ "id" => "1", "parent_cat_name" => "0", "cat_name" => "Test 1", "status" => "1", "position" => "1", "created_at" => "2019-09-03 09:27:45", "updated_at" => "2019-09-03 11:00:54", "children" => [ 0 => [ "id" => "2", "parent_cat_name" => "1", "cat_name" => "Test 2", "status" => "1", "position" => "2", "created_at" => "2019-09-03 09:28:19", "updated_at" => "2019-09-03 11:01:00", "children" => [ 0 => [ "id" => "4", "parent_cat_name" => "2", "cat_name" => "Test 4", "status" => "1", "position" => "4", "created_at" => "2019-09-03 09:35:20", "updated_at" => "2019-09-03 11:01:03", "children" => [ 0 => [ "id" => "5", "parent_cat_name" => "4", "cat_name" => "Test 5", "status" => "1", "position" => "3", "created_at" => "2019-09-07 05:55:09", "updated_at" => "2019-09-07 05:55:09", ], ], ], ], ], ], ], 1 => [ "id" => "3", "parent_cat_name" => "0", "cat_name" => "Test 3", "status" => "1", "position" => "4", "created_at" => "2019-09-03 09:35:10", "updated_at" => "2019-09-03 11:00:58", ], ]; /** * @param $data */ /** * @param $data */ function custom_function($data) { $result = []; if (is_array($data) && count($data) > 0) { $result[] = '<ul>'; foreach ($data as $entry) { if (isset($entry['children'])) { $result[] = sprintf('<li>%s %s</li>', $entry['cat_name'], custom_function($entry['children'])); } else { $result[] = sprintf('<li>%s</li>', $entry['cat_name']); } } $result[] = '</ul>'; } return implode($result); } echo custom_function($arr);

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.140.0130.00817.49
8.4.130.0060.00318.87
8.4.120.0130.00624.14
8.4.110.0120.00822.47
8.4.100.0120.00919.49
8.4.90.0110.01118.98
8.4.80.0160.00517.57
8.4.70.0070.00917.98
8.4.60.0100.01018.73
8.4.50.0100.01019.45
8.4.40.0060.00917.69
8.4.30.0100.01018.78
8.4.20.0040.00419.07
8.4.10.0130.00717.64
8.3.270.0110.00916.84
8.3.260.0090.01016.70
8.3.250.0060.01019.05
8.3.240.0040.00417.29
8.3.230.0100.00916.41
8.3.220.0100.01017.28
8.3.210.0100.00816.85
8.3.200.0110.00516.34
8.3.190.0140.00516.75
8.3.180.0100.00916.49
8.3.170.0030.01617.30
8.3.160.0150.00316.68
8.3.150.0110.00420.96
8.3.140.0040.00417.05
8.3.130.0090.00018.35
8.3.120.0030.01320.84
8.3.110.0090.00616.72
8.3.100.0160.00324.06
8.3.90.0080.00026.77
8.3.80.0090.00016.48
8.3.70.0140.00716.61
8.3.60.0140.00718.30
8.3.50.0040.01218.32
8.3.40.0130.00318.93
8.3.30.0050.01018.63
8.3.20.0080.00022.41
8.3.10.0080.00023.61
8.3.00.0040.00422.32
8.2.290.0090.01020.29
8.2.280.0090.00922.43
8.2.270.0070.01117.19
8.2.260.0070.01116.61
8.2.250.0040.00420.71
8.2.240.0030.00917.34
8.2.230.0090.00020.94
8.2.220.0040.00437.54
8.2.210.0080.00026.77
8.2.200.0070.00416.50
8.2.190.0140.00016.58
8.2.180.0080.00818.54
8.2.170.0110.00422.96
8.2.160.0100.00320.43
8.2.150.0060.00324.18
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00426.16
8.2.110.0060.00320.39
8.2.100.0030.00917.97
8.2.90.0050.00317.75
8.2.80.0030.00518.05
8.2.70.0060.00318.04
8.2.60.0000.00817.91
8.2.50.0040.00418.10
8.2.40.0000.00819.42
8.2.30.0040.00419.40
8.2.20.0000.00718.16
8.2.10.0000.00719.29
8.2.00.0000.00719.10
8.1.330.0090.00921.67
8.1.320.0090.00816.07
8.1.310.0040.00420.16
8.1.300.0060.00318.71
8.1.290.0070.01118.88
8.1.280.0040.01125.92
8.1.270.0080.00022.04
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0090.00023.82
8.1.230.0090.00319.16
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0040.00417.25
8.1.180.0000.00818.10
8.1.170.0030.00518.45
8.1.160.0050.00218.78
8.1.150.0000.00718.93
8.1.140.0070.00020.98
8.1.130.0070.00017.55
8.1.120.0080.00017.54
8.1.110.0040.00417.50
8.1.100.0030.00517.52
8.1.90.0040.00417.39
8.1.80.0040.00417.46
8.1.70.0080.00017.47
8.1.60.0030.00617.58
8.1.50.0060.00317.48
8.1.40.0080.00017.47
8.1.30.0040.00417.70
8.1.20.0080.00017.61
8.1.10.0000.00717.66
8.1.00.0000.00817.46
8.0.300.0040.00419.49
8.0.290.0000.00816.63
8.0.280.0050.00318.38
8.0.270.0000.00717.27
8.0.260.0000.00716.94
8.0.250.0000.00717.00
8.0.240.0030.00716.98
8.0.230.0040.00417.04
8.0.220.0050.00316.84
8.0.210.0040.00416.99
8.0.200.0070.00016.99
8.0.190.0000.00816.98
8.0.180.0080.00016.98
8.0.170.0030.00516.95
8.0.160.0040.00416.98
8.0.150.0030.00416.94
8.0.140.0030.00316.77
8.0.130.0030.00313.34
8.0.120.0040.00416.87
8.0.110.0000.00816.88
8.0.100.0040.00416.96
8.0.90.0000.00716.76
8.0.80.0090.00716.85
8.0.70.0030.00316.88
8.0.60.0040.00416.81
8.0.50.0040.00416.76
8.0.30.0100.00717.02
8.0.20.0120.00616.77
8.0.10.0000.00717.05
8.0.00.0100.01316.89
7.4.330.0000.00516.76
7.4.320.0030.00316.52
7.4.300.0080.00016.64
7.4.290.0000.00716.63
7.4.280.0000.00716.51
7.4.270.0000.00716.56
7.4.260.0000.00513.37
7.4.250.0040.00416.58
7.4.240.0040.00416.54
7.4.230.0050.00216.52
7.4.220.0000.00716.29
7.4.210.0110.00316.52
7.4.200.0070.00016.39
7.4.130.0140.00416.73
7.4.120.0110.00716.68
7.4.110.0060.01116.61
7.4.100.0110.00516.55
7.4.90.0100.00716.52
7.4.80.0030.01419.39
7.4.70.0140.00716.54
7.4.60.0090.00916.54
7.4.50.0120.00316.25
7.4.40.0040.01216.48
7.4.00.0090.00615.03
7.3.330.0000.00716.38
7.3.320.0000.00513.41
7.3.310.0020.00516.24
7.3.300.0070.00016.34
7.3.290.0080.00516.38
7.3.280.0080.01116.38
7.3.260.0120.00616.48
7.3.240.0090.00916.46
7.3.230.0070.01016.56
7.3.210.0030.01416.38
7.3.200.0060.00916.45
7.3.190.0150.00416.66
7.3.180.0140.00416.45
7.3.170.0120.00916.35
7.3.160.0060.01116.52
7.3.90.0030.01214.90
7.3.80.0090.00914.88
7.3.70.0120.00614.78
7.3.60.0100.00314.86
7.3.50.0070.00714.91
7.3.40.0030.01514.85
7.3.30.0140.00014.87
7.3.20.0120.00314.81
7.3.10.0110.00614.95
7.3.00.0040.01114.67
7.2.330.0130.00416.73
7.2.320.0030.02016.77
7.2.310.0070.01016.69
7.2.300.0100.00716.80
7.2.290.0060.01216.49
7.2.220.0000.01514.95
7.2.210.0100.01014.95
7.2.200.0000.01914.81
7.2.190.0060.00915.12
7.2.180.0080.01115.07
7.2.170.0040.01514.90
7.2.160.0020.01615.07
7.2.150.0040.01214.95
7.2.140.0140.01015.18
7.2.130.0060.00915.27
7.2.120.0130.00315.11
7.2.110.0120.00415.18
7.2.100.0140.00715.13
7.2.90.0090.01214.96
7.2.80.0100.00615.08
7.2.70.0060.01315.27
7.2.60.0080.00814.93
7.2.50.0140.00715.12
7.2.40.0060.01015.28
7.2.30.0030.01315.06
7.2.20.0060.00915.35
7.2.10.0090.00615.06
7.2.00.0080.00815.08
7.1.320.0070.00713.96
7.1.310.0670.01013.97
7.1.300.0130.00414.18
7.1.290.0080.01213.86
7.1.280.0110.00414.06
7.1.270.0090.00614.00
7.1.260.0070.00713.74
7.1.250.0090.00613.83

preferences:
30.66 ms | 403 KiB | 5 Q