3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array(1, 2, 3, 4); $array2 = array(1, 2, 5, 6); $array3 = array(1, 2, 6); // The result should contain ONLY: 1 and 2. 6 is not in all 3 results $result = array(); for ($i = 1; $i <= 3; $i++) { $array = 'array' . $i; if (empty($result)) { $result = ${$array}; } else { $inBoth = array_intersect($result, ${$array}); //$notInBoth = array_diff($result, ${$array}); $result = array_diff($result, array_unique(array_merge($result, $inBoth))); } } var_dump($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.3.60.0030.01716.35
8.3.50.0090.00921.92
8.3.40.0120.00318.48
8.3.30.0060.00918.92
8.3.20.0050.00220.29
8.3.10.0040.00421.91
8.3.00.0090.00017.92
8.2.180.0090.00618.41
8.2.170.0110.00422.96
8.2.160.0070.00722.13
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.23
8.2.110.0060.00321.12
8.2.100.0080.00317.89
8.2.90.0040.00417.75
8.2.80.0090.00019.65
8.2.70.0030.00618.03
8.2.60.0040.00417.93
8.2.50.0080.00018.10
8.2.40.0000.00720.65
8.2.30.0040.00418.24
8.2.20.0000.00717.66
8.2.10.0040.00418.00
8.2.00.0000.00717.66
8.1.280.0170.00325.92
8.1.270.0080.00023.82
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00021.16
8.1.230.0110.00020.32
8.1.220.0000.00917.74
8.1.210.0050.00318.77
8.1.200.0030.00617.48
8.1.190.0040.00417.22
8.1.180.0030.00618.10
8.1.170.0090.00018.51
8.1.160.0050.00221.92
8.1.150.0000.00718.79
8.1.140.0050.00217.45
8.1.130.0030.00517.83
8.1.120.0040.00817.45
8.1.110.0040.00417.52
8.1.100.0030.00317.41
8.1.90.0040.00717.45
8.1.80.0000.00817.49
8.1.70.0000.00817.42
8.1.60.0080.00017.58
8.1.50.0000.00817.48
8.1.40.0000.00817.49
8.1.30.0040.00417.59
8.1.20.0000.00817.63
8.1.10.0060.00317.48
8.1.00.0040.00417.32
8.0.300.0050.00319.78
8.0.290.0000.00916.75
8.0.280.0050.00218.44
8.0.270.0050.00317.25
8.0.260.0060.00017.13
8.0.250.0070.00017.00
8.0.240.0030.00316.86
8.0.230.0000.00816.91
8.0.220.0070.00016.78
8.0.210.0000.00716.88
8.0.200.0080.00016.96
8.0.190.0050.00316.90
8.0.180.0040.00416.90
8.0.170.0060.00316.90
8.0.160.0050.00316.95
8.0.150.0050.00316.79
8.0.140.0000.00816.86
8.0.130.0070.00013.28
8.0.120.0040.00416.89
8.0.110.0070.00016.79
8.0.100.0030.00516.90
8.0.90.0040.00416.77
8.0.80.0100.01016.86
8.0.70.0000.00716.83
8.0.60.0000.00816.89
8.0.50.0070.00016.84
8.0.30.0190.00617.08
8.0.20.0130.01217.40
8.0.10.0040.00417.03
8.0.00.0060.01216.83
7.4.330.0000.00615.02
7.4.320.0000.00716.50
7.4.300.0030.00316.52
7.4.290.0030.00316.48
7.4.280.0000.00716.59
7.4.270.0070.00016.52
7.4.260.0040.00716.42
7.4.250.0050.00216.52
7.4.240.0040.00416.61
7.4.230.0040.00416.50
7.4.220.0090.00916.39
7.4.210.0090.00516.56
7.4.200.0000.00816.68
7.4.160.0090.00916.52
7.4.150.0090.01017.40
7.4.140.0130.00617.86
7.4.130.0110.00816.48
7.4.120.0120.00916.53
7.4.110.0150.00316.39
7.4.100.0060.01116.57
7.4.90.0090.00916.30
7.4.80.0000.01919.39
7.4.70.0070.01016.44
7.4.60.0170.00516.45
7.4.50.0000.00916.18
7.4.40.0120.00816.50
7.4.30.0090.00816.48
7.4.00.0030.01014.77
7.3.330.0030.00313.17
7.3.320.0060.00013.27
7.3.310.0000.00716.42
7.3.300.0030.00316.18
7.3.290.0090.00916.28
7.3.280.0070.01316.34
7.3.270.0060.01217.40
7.3.260.0120.00616.35
7.3.250.0170.00316.43
7.3.240.0110.00816.43
7.3.230.0100.01016.43
7.3.210.0090.00916.67
7.3.200.0060.01316.47
7.3.190.0060.01516.67
7.3.180.0090.00616.36
7.3.170.0060.01016.53
7.3.160.0120.00616.30
7.3.120.0030.01014.80
7.3.10.0110.01716.15
7.3.00.0150.01515.74
7.2.330.0060.01216.71
7.2.320.0130.00816.75
7.2.310.0060.01216.60
7.2.300.0060.00916.59
7.2.290.0150.00616.39
7.2.130.0140.00916.48
7.2.120.0260.00416.19
7.2.110.0040.01916.46
7.2.100.0200.01116.91
7.2.90.0230.00416.14
7.2.80.0090.01216.43
7.2.70.0140.00316.27
7.2.60.0120.01016.58
7.2.50.0180.00316.53
7.2.40.0300.00416.93
7.2.30.0130.00716.55
7.2.20.0130.00716.08
7.2.10.0090.01216.22
7.2.00.0090.00717.88
7.1.250.0130.01315.23
7.1.200.0060.00615.91
7.1.100.0090.00918.07
7.1.70.0100.00316.92
7.1.60.0000.01217.16
7.1.50.0200.01634.86
7.1.00.0030.07322.47
7.0.200.0040.01116.86
7.0.140.0000.07721.95
7.0.60.0030.07719.92
7.0.50.0030.08317.87
7.0.40.0200.06720.12
7.0.30.0470.07720.09
7.0.20.0230.08320.00
7.0.10.0300.07720.01
7.0.00.0030.04020.31
5.6.280.0030.07321.09
5.6.210.0030.08320.70
5.6.200.0070.04718.16
5.6.190.0070.04020.77
5.6.180.0330.06020.24
5.6.170.0200.03720.50
5.6.160.0100.08020.49
5.6.150.0030.08718.19
5.6.140.0030.07018.21
5.6.130.0070.08018.18
5.6.120.0100.07320.98
5.6.110.0130.07720.88
5.6.100.0170.08021.11
5.6.90.0070.05020.99
5.6.80.0070.04320.35
5.6.70.0400.06020.37
5.5.350.0170.08020.39
5.5.340.0030.05017.95
5.5.330.0100.08320.21
5.5.320.0030.08320.17
5.5.310.0330.04320.33
5.5.300.0030.08718.02
5.5.290.0070.07717.98
5.5.280.0130.04320.86
5.5.270.0030.04020.96
5.5.260.0100.07020.95
5.5.250.0130.07320.63
5.5.240.0030.08720.18
5.4.450.0600.05719.43
5.4.440.0870.05319.50
5.4.430.0930.06719.10
5.4.420.0630.00019.49
5.4.410.0100.06018.84
5.4.400.0900.05318.78
5.4.390.1170.07318.46
5.4.380.0230.05318.72
5.4.370.0000.06018.59
5.4.360.0170.04318.74
5.4.350.0040.03511.98
5.4.340.0070.03511.97
5.4.320.0070.03512.46
5.4.310.0080.04612.45
5.4.300.0090.03912.45
5.4.290.0080.04012.45
5.4.280.0050.03612.35
5.4.270.0040.03712.35
5.4.260.0050.03912.35
5.4.250.0030.03912.35
5.4.240.0060.03512.35
5.4.230.0030.04012.34
5.4.220.0040.03712.34
5.4.210.0060.03412.34
5.4.200.0040.03812.34
5.4.190.0070.03612.34
5.4.180.0080.03512.34
5.4.170.0080.03712.35
5.4.160.0090.03612.35
5.4.150.0090.03612.34
5.4.140.0090.04212.03
5.4.130.0030.04512.02
5.4.120.0050.03511.97
5.4.110.0080.03411.97
5.4.100.0020.03811.97
5.4.90.0040.03711.96
5.4.80.0070.03411.97
5.4.70.0050.04011.96
5.4.60.0140.03111.96
5.4.50.0080.03911.96
5.4.40.0070.03311.95
5.4.30.0080.03911.95
5.4.20.0030.04211.95
5.4.10.0080.03611.95
5.4.00.0030.03711.44
5.3.290.0100.04412.80
5.3.280.0070.03712.71
5.3.270.0060.04712.72
5.3.260.0060.04212.72
5.3.250.0040.03912.72
5.3.240.0060.04112.72
5.3.230.0040.03812.71
5.3.220.0070.03812.68
5.3.210.0050.05012.68
5.3.200.0070.04012.68
5.3.190.0080.03412.68
5.3.180.0050.03612.67
5.3.170.0030.03912.67
5.3.160.0040.03712.68
5.3.150.0080.03512.68
5.3.140.0050.03712.66
5.3.130.0060.03912.66
5.3.120.0040.04012.66
5.3.110.0060.03912.66
5.3.100.0050.03712.12
5.3.90.0060.03512.09
5.3.80.0020.04012.07
5.3.70.0050.03712.07
5.3.60.0040.03712.07
5.3.50.0090.03212.00
5.3.40.0070.03912.00
5.3.30.0050.03611.95
5.3.20.0070.03411.72
5.3.10.0050.03611.69
5.3.00.0070.03611.68
5.2.170.0030.0319.18
5.2.160.0050.0289.18
5.2.150.0040.0309.18
5.2.140.0020.0329.18
5.2.130.0040.0299.14
5.2.120.0040.0289.14
5.2.110.0070.0359.14
5.2.100.0060.0309.14
5.2.90.0090.0269.14
5.2.80.0060.0299.14
5.2.70.0040.0369.14
5.2.60.0040.0299.09
5.2.50.0040.0299.06
5.2.40.0050.0289.04
5.2.30.0040.0379.02
5.2.20.0030.0359.00
5.2.10.0080.0268.94
5.2.00.0050.0288.80
5.1.60.0040.0278.08
5.1.50.0030.0258.08
5.1.40.0040.0248.06
5.1.30.0040.0268.41
5.1.20.0050.0258.43
5.1.10.0060.0268.16
5.1.00.0040.0278.16
5.0.50.0040.0196.64
5.0.40.0020.0206.50
5.0.30.0010.0336.31
5.0.20.0010.0226.28
5.0.10.0040.0196.26
5.0.00.0050.0316.25
4.4.90.0040.0184.78
4.4.80.0020.0164.75
4.4.70.0040.0174.75
4.4.60.0010.0184.75
4.4.50.0030.0144.77
4.4.40.0030.0244.71
4.4.30.0020.0194.76
4.4.20.0060.0124.84
4.4.10.0030.0154.85
4.4.00.0060.0264.76
4.3.110.0000.0184.66
4.3.100.0030.0144.66
4.3.90.0040.0194.63
4.3.80.0030.0244.58
4.3.70.0020.0154.63
4.3.60.0030.0204.63
4.3.50.0010.0164.63
4.3.40.0010.0304.54
4.3.30.0000.0173.31
4.3.20.0030.0193.28
4.3.10.0010.0213.25
4.3.00.0130.0207.27

preferences:
71.19 ms | 400 KiB | 5 Q