3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array( 'id' => 1, 'user_name'=>'test1' ), array( 'id' => 2, 'user_name'=>'test2' ), array( 'id' => 3, 'user_name'=>'test3' ) ); $arr2 = array( array( 'id' => 1, 'shop_name'=>'shop1' ), array( 'id' => 5, 'shop_name'=>'shop2' ), array( 'id' => 3, 'shop_name'=>'shop3' ) ); /*function filter($item) { return count($item) == 3 ? $item :false; } $newArr = array_filter(array_merge($arr, $arr2), 'filter'); print_r($newArr); foreach($arr as $key => &$value) { //$value['shop_name']=''; } unset( $value ); foreach($arr as $k2 =>&$v2) {$v2['shop_name']=''; foreach($arr2 as $k =>$v) { if($v2['id'] == $v['id']) { $v2['shop_name'] = $v['shop_name']; } } } print_r($arr);*/ $user_name = array_column($arr, 'user_name', 'id'); $shop_name = array_column($arr, 'shop_name', 'id'); $arr = []; foreach($user_name as $id => $user) { $temp = ['id'=>$id, 'user_name'=>$user, 'shop_name'=>'']; if(array_key_exists($id, $shop_name)) $temp['shop_name'] = $shop_name[$id]; $arr[] = $temp; } print_r($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.3.70.0090.00618.33
8.3.60.0130.00318.43
8.3.50.0140.00322.04
8.3.40.0120.00318.89
8.3.30.0160.00318.79
8.3.20.0080.00018.67
8.3.10.0040.00420.54
8.3.00.0090.00017.59
8.2.180.0060.01216.75
8.2.170.0100.00722.96
8.2.160.0130.00722.11
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0070.00019.81
8.2.110.0090.00022.20
8.2.100.0040.00818.03
8.2.90.0030.00619.17
8.2.80.0000.00817.97
8.2.70.0060.00317.63
8.2.60.0000.00717.93
8.2.50.0000.00818.07
8.2.40.0040.00418.22
8.2.30.0030.00519.92
8.2.20.0070.00017.78
8.2.10.0030.00617.61
8.2.00.0000.00817.85
8.1.280.0150.00325.92
8.1.270.0080.00023.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0130.00020.70
8.1.230.0090.00320.75
8.1.220.0030.00518.77
8.1.210.0040.00418.81
8.1.200.0070.00317.35
8.1.190.0000.00917.50
8.1.180.0090.00018.10
8.1.170.0000.00918.95
8.1.160.0000.00718.86
8.1.150.0000.00818.68
8.1.140.0040.00417.41
8.1.130.0030.00317.73
8.1.120.0030.00517.47
8.1.110.0020.00517.42
8.1.100.0030.00517.35
8.1.90.0040.00417.48
8.1.80.0070.00017.45
8.1.70.0030.00617.41
8.1.60.0000.00717.61
8.1.50.0060.00317.48
8.1.40.0000.00717.42
8.1.30.0000.00817.48
8.1.20.0000.00817.65
8.1.10.0000.00717.43
8.1.00.0000.00717.41
8.0.300.0000.00819.98
8.0.290.0070.00016.63
8.0.280.0000.00718.38
8.0.270.0070.00017.16
8.0.260.0030.00516.82
8.0.250.0070.00017.00
8.0.240.0030.00716.95
8.0.230.0000.00816.94
8.0.220.0040.00416.83
8.0.210.0000.00616.88
8.0.200.0000.00716.96
8.0.190.0050.00316.92
8.0.180.0080.00016.90
8.0.170.0070.00316.92
8.0.160.0050.00216.90
8.0.150.0060.00316.83
8.0.140.0050.00316.88
8.0.130.0050.00013.29
8.0.120.0040.00416.83
8.0.110.0060.00316.89
8.0.100.0050.00216.89
8.0.90.0000.00816.91
8.0.80.0060.00916.85
8.0.70.0000.00916.78
8.0.60.0000.00816.91
8.0.50.0000.00716.85
8.0.30.0100.00816.91
8.0.20.0120.00717.40
8.0.10.0000.00717.02
8.0.00.0100.00916.82
7.4.330.0020.00214.78
7.4.320.0030.00316.65
7.4.300.0060.00016.48
7.4.290.0000.00716.61
7.4.280.0000.00716.65
7.4.270.0000.00716.61
7.4.260.0000.00613.32
7.4.250.0030.00516.58
7.4.240.0070.00016.62
7.4.230.0000.00716.40
7.4.220.0100.01716.45
7.4.210.0070.00816.54
7.4.200.0030.00316.70
7.4.190.0040.00416.76
7.4.160.0110.00516.44
7.4.150.0090.00917.40
7.4.140.0130.00817.13
7.4.130.0110.00816.45
7.4.120.0080.00816.57
7.4.110.0030.01416.64
7.4.100.0140.00416.37
7.4.90.0110.00716.62
7.4.80.0130.00319.03
7.4.70.0110.00816.45
7.4.60.0070.01016.46
7.4.50.0000.00616.63
7.4.40.0140.00022.27
7.4.30.0140.00616.57
7.4.00.0100.00615.00
7.3.330.0050.00013.25
7.3.320.0050.00013.06
7.3.310.0000.00716.18
7.3.300.0070.00016.35
7.3.290.0140.00616.32
7.3.280.0090.01016.33
7.3.270.0070.01017.40
7.3.260.0130.00618.24
7.3.250.0110.01116.62
7.3.240.0030.01316.48
7.3.230.0060.01016.66
7.3.210.0120.00616.33
7.3.200.0090.01519.39
7.3.190.0070.01716.47
7.3.180.0040.01116.26
7.3.170.0150.00616.52
7.3.160.0060.01016.23
7.3.120.0110.00714.82
7.3.00.0060.00816.53
7.2.330.0090.00616.75
7.2.320.0070.01316.66
7.2.310.0120.01316.41
7.2.300.0080.00816.72
7.2.290.0060.01016.63
7.2.130.0050.00716.97
7.2.120.0050.00816.65
7.2.110.0050.00716.89
7.2.100.0070.00816.86
7.2.90.0070.00616.75
7.2.80.0080.00616.83
7.2.70.0090.00516.90
7.2.60.0040.00916.95
7.2.50.0120.00317.02
7.2.40.0070.00516.73
7.2.30.0040.00916.88
7.2.20.0100.00316.75
7.2.10.0090.00216.85
7.2.00.0050.00917.73
7.1.250.0040.00815.80
7.1.240.0060.00615.86
7.1.230.0050.00915.90
7.1.220.0060.00615.73
7.1.210.0090.00515.94
7.1.200.0020.01015.65
7.1.190.0030.00815.76
7.1.180.0060.00815.73
7.1.170.0020.01215.79
7.1.160.0030.00715.87
7.1.150.0030.00815.68
7.1.140.0050.01015.86
7.1.130.0080.00615.87
7.1.120.0030.01015.70
7.1.110.0050.01015.69
7.1.100.0080.00516.64
7.1.90.0050.00715.81
7.1.80.0080.00715.78
7.1.70.0040.00616.16
7.1.60.0070.00917.02
7.1.50.0070.00716.19
7.1.40.0080.00515.86
7.1.30.0050.00515.77
7.1.20.0030.01015.68
7.1.10.0020.00915.56
7.1.00.0060.01918.01
7.0.330.0090.00415.37
7.0.320.0070.00515.48
7.0.310.0050.00615.26
7.0.300.0020.01015.41
7.0.290.0030.00615.32
7.0.280.0060.00615.46
7.0.270.0030.00915.31
7.0.260.0050.00815.24
7.0.250.0100.00615.27
7.0.240.0050.00815.39
7.0.230.0080.00315.40
7.0.220.0070.00715.38
7.0.210.0030.01015.18
7.0.200.0020.00915.75
7.0.190.0040.00915.50
7.0.180.0000.01315.38
7.0.170.0070.01015.41
7.0.160.0070.00615.48
7.0.150.0050.00915.45
7.0.140.0060.01717.56
7.0.130.0020.01415.19
7.0.120.0060.00615.40
7.0.110.0060.00815.24
7.0.100.0000.01015.40
7.0.90.0050.00615.34
7.0.80.0060.00615.29
7.0.70.0050.00815.24
7.0.60.0080.02617.02
7.0.50.0070.02016.21
7.0.40.0030.03114.79
7.0.30.0050.03314.98
7.0.20.0080.02014.93
7.0.10.0060.02214.92
7.0.00.0060.02014.94
5.6.380.0060.00814.29
5.6.370.0110.00414.42
5.6.360.0070.00714.73
5.6.350.0050.00714.44
5.6.340.0080.00314.52
5.6.330.0070.00914.42
5.6.320.0030.01014.34
5.6.310.0070.00914.39
5.6.300.0050.00814.44
5.6.290.0060.00514.56
5.6.280.0050.02816.62
5.6.270.0050.00614.49
5.6.260.0020.01214.25
5.6.250.0080.00814.28
5.6.240.0110.00214.56
5.6.230.0040.00414.61
5.6.220.0050.00714.06
5.6.210.0040.02216.37
5.6.200.0080.03015.49
5.6.190.0070.03115.63
5.6.180.0040.02615.60
5.6.170.0070.02915.65
5.6.160.0060.02215.47
5.6.150.0020.04015.68
5.6.140.0060.03515.63
5.6.130.0060.03315.70
5.6.120.0060.02215.70
5.6.110.0110.02815.71
5.6.100.0080.03215.65
5.6.90.0070.02315.73
5.6.80.0070.01715.18
5.6.70.0020.02415.36
5.6.60.0040.01915.41
5.6.50.0080.02815.36
5.6.40.0090.02915.39
5.6.30.0060.02015.40
5.6.20.0090.02015.40
5.6.10.0040.03315.37
5.6.00.0050.02415.34
5.5.380.0090.00311.38
5.5.370.0050.00411.24
5.5.360.0040.00511.22
5.5.350.1380.02114.23
5.5.340.0040.02013.43
5.5.330.0050.02013.54
5.5.320.0080.02813.50
5.5.310.0070.02113.54
5.5.300.0040.02313.54
5.5.290.0010.02513.34
5.5.280.0060.03013.51
5.5.270.0060.02413.43
5.5.260.0050.02513.47
5.5.250.0100.02913.40
5.5.240.0010.03113.29
5.5.230.0060.02813.12
5.5.220.0060.03013.28
5.5.210.0050.03213.21
5.5.200.0070.02313.19
5.5.190.0060.02713.15
5.5.180.0060.02713.15
5.5.170.0030.00710.95
5.5.160.0040.02113.21
5.5.150.0040.03313.31
5.5.140.0070.02713.12
5.5.130.0070.02213.16
5.5.120.0030.01813.18
5.5.110.0080.01513.32
5.5.100.0020.01813.21
5.5.90.0030.02113.10
5.5.80.0040.02013.31
5.5.70.0060.01913.24
5.5.60.0050.02613.26
5.5.50.0030.03113.29
5.5.40.0060.02913.15
5.5.30.0010.03213.20
5.5.20.0020.03213.13
5.5.10.0050.02013.11
5.5.00.0020.03313.26
5.4.450.0060.02213.85
5.4.440.0020.02813.72
5.4.430.0040.01713.85
5.4.420.0040.02313.73
5.4.410.0020.02613.65
5.4.400.0040.03113.61
5.4.390.0050.02813.71
5.4.380.0010.03213.69
5.4.370.0020.02213.70
5.4.360.0060.02713.61
5.4.350.0080.01213.64
5.4.340.0030.02913.54
5.4.330.0040.00610.95
5.4.320.0040.02913.65
5.4.310.0040.01613.54
5.4.300.0070.02013.60
5.4.290.0090.02713.58
5.4.280.0040.01513.69
5.4.270.0050.01613.59
5.4.260.0040.01713.63
5.4.250.0010.01813.69
5.4.240.0040.02713.65
5.4.230.0030.01913.68
5.4.220.0060.02113.59
5.4.210.0060.02013.79
5.4.200.0040.02813.70
5.4.190.0130.01913.62
5.4.180.0050.01813.61
5.4.170.0030.02013.63
5.4.160.0020.03313.59
5.4.150.0030.02713.68
5.4.140.0030.01812.68
5.4.130.0030.03112.69
5.4.120.0020.02212.77
5.4.110.0060.02412.74
5.4.100.0020.01912.77
5.4.90.0050.02712.77
5.4.80.0030.01512.78
5.4.70.0040.01412.70
5.4.60.0040.01412.75
5.4.50.0070.01312.69
5.4.40.0010.01812.67
5.4.30.0060.01412.67
5.4.20.0020.01612.74
5.4.10.0030.01512.61
5.4.00.0010.02012.56
5.3.290.0000.02412.04
5.3.280.0030.02311.95
5.3.270.0070.02112.03
5.3.260.0050.01612.01
5.3.250.0060.02511.94
5.3.240.0080.01111.94
5.3.230.0050.02411.94
5.3.220.0030.02211.90
5.3.210.0020.02111.88
5.3.200.0040.02911.92
5.3.190.0040.01611.91
5.3.180.0040.01512.02
5.3.170.0050.01611.99
5.3.160.0010.01512.00
5.3.150.0020.01611.97
5.3.140.0030.01611.99
5.3.130.0040.01611.92
5.3.120.0020.01711.86
5.3.110.0040.02511.92
5.3.100.0040.02211.77
5.3.90.0020.01711.82
5.3.80.0050.01711.78
5.3.70.0020.01911.74
5.3.60.0030.03011.79
5.3.50.0020.01811.73
5.3.40.0070.01411.78
5.3.30.0050.01511.73
5.3.20.0030.01511.73
5.3.10.0020.01811.61
5.3.00.0030.01411.55
5.2.170.0030.01610.79
5.2.160.0040.01210.74
5.2.150.0020.01510.79
5.2.140.0040.01110.77
5.2.130.0030.01110.76
5.2.120.0030.01210.78
5.2.110.0050.00910.77
5.2.100.0040.01110.72
5.2.90.0030.01310.77
5.2.80.0040.01110.75
5.2.70.0050.01210.77
5.2.60.0030.01310.69
5.2.50.0040.01110.75
5.2.40.0060.00810.67
5.2.30.0030.01210.73
5.2.20.0030.01410.72
5.2.10.0020.01210.75
5.2.00.0030.01310.63
5.1.60.0040.00810.42
5.1.50.0040.01210.41
5.1.40.0030.01110.43
5.1.30.0010.01210.54
5.1.20.0030.01010.58
5.1.10.0030.00910.45
5.1.00.0050.01110.49
5.0.50.0040.0079.87
5.0.40.0020.0109.88
5.0.30.0030.0119.82
5.0.20.0040.0069.80
5.0.10.0030.0119.80
5.0.00.0030.0249.83
4.4.90.0020.0079.64
4.4.80.0030.0089.64
4.4.70.0020.0069.64
4.4.60.0010.0099.64
4.4.50.0030.0069.64
4.4.40.0010.0119.64
4.4.30.0030.0079.64
4.4.20.0000.0099.64
4.4.10.0030.0089.64
4.4.00.0000.0129.64
4.3.110.0020.0079.64
4.3.100.0030.0069.64
4.3.90.0020.0089.64
4.3.80.0020.0199.64
4.3.70.0010.0089.64
4.3.60.0030.0109.64
4.3.50.0020.0119.64
4.3.40.0050.0179.64
4.3.30.0010.0089.64
4.3.20.0000.0169.64
4.3.10.0010.0089.64
4.3.00.0010.0099.64

preferences:
41.88 ms | 401 KiB | 5 Q