3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = json_decode('{"1":{"id":"1","source_name":"kk56ca1d0f2378f","company_id":"1","lft":"1","rgt":"18","parent_id":"0","children":{"2":{"id":"2","source_name":"kk56ca1d17f3f63","company_id":"1","lft":"2","rgt":"3","parent_id":"1","children":[]},"3":{"id":"3","source_name":"kk56ca1d1ebe975","company_id":"1","lft":"4","rgt":"13","parent_id":"1","children":{"6":{"id":"6","source_name":"kk56ca1fc882ac0","company_id":"1","lft":"5","rgt":"10","parent_id":"3","children":[]}}}}}}',1); function convert_array( $array ) { $retval = array(); foreach( $array as $row ) { $child = array(); $child['id'] = $row['id']; $child['text'] = $row['source_name']; $child['parent_id'] = $row['parent_id']; if( count( $row['children'] ) ) { $child['nodes'] = convert_array( $row['children'] ); } else { $child['nodes'] = array(); } $retval[] = $child; } return $retval; } $result = convert_array( $array ); print_r( $result );

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.5.10.0060.00320.21
8.5.00.0130.01020.07
8.4.150.0020.00014.05
8.4.140.0150.00617.33
8.4.130.0120.00917.91
8.4.120.0130.00720.47
8.4.110.0100.01018.70
8.4.100.0120.00917.47
8.4.90.0140.00817.58
8.4.80.0090.01117.61
8.4.70.0100.00818.02
8.4.60.0130.00718.56
8.4.50.0120.00918.52
8.4.40.0000.00817.66
8.4.30.0070.01417.59
8.4.20.0140.00717.84
8.4.10.0030.01317.47
8.3.280.0130.00718.51
8.3.270.0160.00516.48
8.3.260.0130.00716.61
8.3.250.0100.01019.18
8.3.240.0060.00316.70
8.3.230.0110.00816.43
8.3.220.0140.00416.46
8.3.210.0150.00516.87
8.3.200.0080.01116.63
8.3.190.0080.00017.21
8.3.180.0150.00616.57
8.3.170.0100.00917.22
8.3.160.0150.00318.66
8.3.150.0090.00916.73
8.3.140.0090.00617.33
8.3.130.0030.00518.48
8.3.120.0040.00420.65
8.3.110.0040.00420.94
8.3.100.0030.00616.48
8.3.90.0040.00426.77
8.3.80.0110.00416.25
8.3.70.0110.01116.72
8.3.60.0100.01316.75
8.3.50.0290.00922.00
8.3.40.0070.01118.84
8.3.30.0110.00418.71
8.3.20.0000.00820.04
8.3.10.0080.00020.36
8.3.00.0080.00020.64
8.2.290.0040.00418.74
8.2.280.0110.00718.41
8.2.270.0110.00717.41
8.2.260.0040.00418.54
8.2.250.0070.00716.61
8.2.240.0040.00417.18
8.2.230.0030.00722.58
8.2.220.0040.00424.06
8.2.210.0130.00626.77
8.2.200.0000.00916.35
8.2.190.0070.01118.29
8.2.180.0140.00318.29
8.2.170.0070.00719.13
8.2.160.0070.00720.52
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0080.00019.48
8.2.120.0070.00026.35
8.2.110.0050.00520.33
8.2.100.0000.01219.57
8.2.90.0060.00319.21
8.2.80.0000.00817.97
8.2.70.0100.00017.35
8.2.60.0000.01117.93
8.2.50.0030.00518.09
8.2.40.0000.00820.59
8.2.30.0040.00419.39
8.2.20.0040.00417.67
8.2.10.0040.00418.13
8.2.00.0000.00918.00
8.1.330.0140.00515.97
8.1.320.0040.00316.02
8.1.310.0070.01118.34
8.1.300.0090.00916.22
8.1.290.0060.00618.88
8.1.280.0000.01825.92
8.1.270.0040.01523.79
8.1.260.0080.00028.09
8.1.250.0060.00328.09
8.1.240.0080.00022.14
8.1.230.0030.00917.54
8.1.220.0000.00917.77
8.1.210.0030.00618.77
8.1.200.0070.00317.36
8.1.190.0030.00617.10
8.1.180.0040.00418.10
8.1.170.0030.00518.58
8.1.160.0040.00420.90
8.1.150.0030.00318.89
8.1.140.0000.00819.59
8.1.130.0000.00717.71
8.1.120.0070.00017.37
8.1.110.0000.00817.36
8.1.100.0050.00317.44
8.1.90.0030.00617.48
8.1.80.0050.00317.47
8.1.70.0040.00417.41
8.1.60.0030.00617.59
8.1.50.0040.00417.55
8.1.40.0040.00417.50
8.1.30.0030.00517.49
8.1.20.0000.00817.72
8.1.10.0000.00717.51
8.1.00.0000.00717.39
8.0.300.0040.00418.77
8.0.290.0060.00316.63
8.0.280.0030.00518.34
8.0.270.0000.00717.17
8.0.260.0050.00317.13
8.0.250.0000.00716.86
8.0.240.0040.00416.86
8.0.230.0000.00716.83
8.0.220.0040.00416.79
8.0.210.0070.00016.82
8.0.200.0000.00616.84
8.0.190.0000.00816.92
8.0.180.0040.00416.95
8.0.170.0040.00416.91
8.0.160.0030.00516.94
8.0.150.0070.00016.79
8.0.140.0000.00716.88
8.0.130.0060.00013.40
8.0.120.0000.00816.74
8.0.110.0040.00416.84
8.0.100.0040.00417.00
8.0.90.0030.00516.89
8.0.80.0120.00616.91
8.0.70.0000.00716.66
8.0.60.0000.00716.88
8.0.50.0040.00416.77
8.0.30.0100.00716.97
8.0.20.0120.01017.40
8.0.10.0060.00316.95
8.0.00.0100.00716.75
7.4.330.0020.00216.73
7.4.320.0060.00016.63
7.4.300.0030.00316.51
7.4.290.0030.00316.46
7.4.280.0020.00516.48
7.4.270.0040.00416.55
7.4.260.0040.00416.50
7.4.250.0030.00516.59
7.4.240.0030.00516.60
7.4.230.0000.00716.58
7.4.220.0110.00316.38
7.4.210.0080.00616.53
7.4.200.0030.00316.41
7.4.160.0000.01616.45
7.4.150.0110.00717.40
7.4.140.0130.00917.86
7.4.130.0100.01216.40
7.4.120.0090.00916.48
7.4.110.0090.00816.50
7.4.100.0210.00416.59
7.4.90.0110.00716.42
7.4.80.0060.00919.39
7.4.70.0100.01016.50
7.4.60.0070.01016.50
7.4.50.0080.00816.64
7.4.40.0090.00616.43
7.4.30.0100.00616.49
7.4.10.0140.00014.84
7.4.00.0060.01114.78
7.3.330.0060.00013.20
7.3.320.0030.00313.23
7.3.310.0000.00816.40
7.3.300.0000.00716.42
7.3.290.0030.00316.38
7.3.280.0090.00816.37
7.3.270.0130.01017.40
7.3.260.0130.00716.52
7.3.250.0110.00916.42
7.3.240.0080.01116.59
7.3.230.0130.00316.55
7.3.210.0130.00316.23
7.3.200.0000.01716.48
7.3.190.0100.00716.41
7.3.180.0000.01516.68
7.3.170.0110.00716.54
7.3.160.0100.01116.40
7.3.130.0060.01214.77
7.3.120.0070.01014.97
7.3.110.0030.01414.98
7.3.100.0020.01314.59
7.3.90.0060.00914.95
7.3.80.0080.01014.97
7.3.70.0050.00714.78
7.3.60.0050.01014.82
7.3.50.0070.00614.73
7.3.40.0080.00514.62
7.3.30.0060.00614.73
7.3.20.0010.01116.69
7.3.10.0060.00816.63
7.3.00.0070.00516.62
7.2.330.0110.00716.52
7.2.320.0070.01016.76
7.2.310.0080.01116.67
7.2.300.0090.00916.58
7.2.290.0070.01316.59
7.2.260.0150.00414.98
7.2.250.0090.01115.04
7.2.240.0120.00515.04
7.2.230.0050.01114.84
7.2.220.0030.01214.97
7.2.210.0140.00314.97
7.2.200.0030.01015.16
7.2.190.0100.00314.99
7.2.180.0060.00815.06
7.2.170.0070.00915.04
7.2.160.0060.00315.09
7.2.150.0030.01016.89
7.2.140.0000.01517.01
7.2.130.0060.00616.89
7.2.120.0070.00616.79
7.2.110.0060.00816.92
7.2.100.0030.01116.87
7.2.90.0040.00816.90
7.2.80.0120.00216.75
7.2.70.0070.00716.88
7.2.60.0050.00716.95
7.2.50.0040.01116.95
7.2.40.0050.00916.90
7.2.30.0050.00616.92
7.2.20.0040.00916.98
7.2.10.0060.00516.97
7.2.00.0040.01017.58
7.1.330.0050.00815.72
7.1.320.0040.00815.83
7.1.310.0050.00715.99
7.1.300.0040.00515.65
7.1.290.0050.00915.71
7.1.280.0040.00715.72
7.1.270.0040.00615.88
7.1.260.0020.01415.79
7.1.250.0080.00315.70
7.1.240.0050.00715.73
7.1.230.0060.00815.75
7.1.220.0080.00415.72
7.1.210.0020.01015.77
7.1.200.0070.00615.77
7.1.190.0060.00615.91
7.1.180.0040.00915.75
7.1.170.0030.01015.76
7.1.160.0060.00515.75
7.1.150.0030.01015.95
7.1.140.0040.01115.88
7.1.130.0030.00715.64
7.1.120.0050.00615.90
7.1.110.0040.01015.74
7.1.100.0060.00716.56
7.1.90.0020.01215.82
7.1.80.0030.00615.82
7.1.70.0050.00716.13
7.1.60.0080.00916.92
7.1.50.0060.00715.74
7.1.40.0060.00515.74
7.1.30.0020.01215.74
7.1.20.0030.00915.67
7.1.10.0060.00615.90
7.1.00.0040.02818.01
7.0.330.0040.01115.43
7.0.320.0030.01415.44
7.0.310.0090.00515.54
7.0.300.0070.00715.41
7.0.290.0040.01115.21
7.0.280.0110.00515.39
7.0.270.0060.00715.36
7.0.260.0020.01215.49
7.0.250.0070.00515.38
7.0.240.0080.00515.47
7.0.230.0050.00615.49
7.0.220.0030.00915.43
7.0.210.0090.00815.39
7.0.200.0030.01015.92
7.0.190.0090.00515.41
7.0.180.0090.00415.49
7.0.170.0050.00815.53
7.0.160.0070.00715.41
7.0.150.0070.00315.54
7.0.140.0090.00315.39
7.0.130.0030.00915.45
7.0.120.0080.00515.25
7.0.110.0060.01015.59
7.0.100.0050.01015.38
7.0.90.0050.00715.53
7.0.80.0080.00515.44
7.0.70.0040.01115.48
7.0.60.0120.02416.96
7.0.50.0070.01916.38
7.0.40.0080.01815.67
7.0.30.0240.01715.50
7.0.20.0160.03615.66
7.0.10.0040.02415.72
7.0.00.0060.03215.77
5.6.400.0070.01014.05
5.6.390.0030.00914.24
5.6.380.0030.01014.33
5.6.370.0130.00314.50
5.6.360.0100.00314.72
5.6.350.0050.00814.55
5.6.340.0080.00714.41
5.6.330.0070.00514.65
5.6.320.0060.00814.42
5.6.310.0050.01214.52
5.6.300.0070.00514.46
5.6.290.0080.00614.47
5.6.280.0070.02816.45
5.6.270.0090.00514.25
5.6.260.0100.00614.50
5.6.250.0030.01314.64
5.6.240.0050.00814.54
5.6.230.0040.00814.45
5.6.220.0120.00214.17
5.6.210.0050.02916.41
5.6.200.0100.02015.54
5.6.190.0070.02016.47
5.6.180.0100.02816.55
5.6.170.0150.01316.50
5.6.160.0100.02316.43
5.6.150.0100.01715.81
5.6.140.0070.01615.72
5.6.130.0080.02315.67
5.6.120.0060.02916.70
5.6.110.0110.03016.55
5.6.100.0070.01816.65
5.6.90.0050.02116.57
5.6.80.0030.03316.31
5.6.70.0100.00514.14
5.6.60.0020.01214.44
5.6.50.0130.00314.24
5.6.40.0070.00914.33
5.6.30.0110.00514.20
5.6.20.0070.00214.21
5.6.10.0010.01214.42
5.6.00.0060.00714.51
5.5.380.0100.00512.69
5.5.370.0070.01012.68
5.5.360.0100.00312.83
5.5.350.0180.02415.33
5.5.340.0080.02814.58
5.5.330.0070.02115.34
5.5.320.0110.02015.29
5.5.310.0160.02015.41
5.5.300.0070.02614.73
5.5.290.0100.02314.47
5.5.280.0020.02815.37
5.5.270.0090.02815.50
5.5.260.0100.02815.47
5.5.250.0110.02115.38
5.5.240.0080.02915.15
5.5.230.0040.00612.67
5.5.220.0060.00612.69
5.5.210.0030.01212.73
5.5.200.0100.00612.53
5.5.190.0050.00912.72
5.5.180.0020.00912.69
5.5.170.0050.01012.76
5.5.160.0030.00712.95
5.5.150.0070.00712.69
5.5.140.0060.00612.88
5.5.130.0080.00512.69
5.5.120.0070.00612.55
5.5.110.0070.00512.99
5.5.100.0080.00512.76
5.5.90.0060.00612.84
5.5.80.0040.00712.82
5.5.70.0030.01112.75
5.5.60.0020.01412.72
5.5.50.0050.00712.61
5.5.40.0100.00212.71
5.5.30.0080.00612.64
5.5.20.0090.00512.70
5.5.10.0050.00512.54
5.5.00.0040.00912.74

preferences:
39.87 ms | 403 KiB | 5 Q