3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "1,5"; $base = array('1'=>'Bread','5'=>'Butter'); $flipped = array_flip( explode(',', $str)); print_r( $flipped); print_r( array_merge( array_flip( $flipped), $base)); $intersection = array_intersect_key( array_merge( $flipped, $base), $flipped); print_r( $intersection); $replacements = array_values( $intersection); print_r( $replacements);

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.0080.01116.49
8.3.50.0100.00718.17
8.3.40.0130.00318.89
8.3.30.0090.00918.64
8.3.20.0050.00318.61
8.3.10.0000.00820.35
8.3.00.0160.00019.26
8.2.180.0040.01125.92
8.2.170.0160.00318.96
8.2.160.0140.00722.96
8.2.150.0080.00025.66
8.2.140.0070.01324.66
8.2.130.0040.00426.16
8.2.120.0040.00420.36
8.2.110.0040.00720.86
8.2.100.0080.00417.47
8.2.90.0030.00619.17
8.2.80.0000.00919.21
8.2.70.0080.00017.34
8.2.60.0090.00017.92
8.2.50.0030.00518.07
8.2.40.0100.00018.09
8.2.30.0060.00518.06
8.2.20.0000.00919.44
8.2.10.0070.00017.61
8.2.00.0000.00717.70
8.1.280.0030.01225.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0090.00022.33
8.1.230.0030.00721.10
8.1.220.0050.00317.74
8.1.210.0040.00418.84
8.1.200.0040.00817.35
8.1.190.0000.00717.39
8.1.180.0030.00518.10
8.1.170.0050.00318.85
8.1.160.0090.00018.83
8.1.150.0000.00818.50
8.1.140.0000.00717.32
8.1.130.0070.00017.71
8.1.120.0060.00317.35
8.1.110.0000.00717.39
8.1.100.0000.00717.43
8.1.90.0040.00417.31
8.1.80.0000.00717.30
8.1.70.0040.00417.42
8.1.60.0040.00417.55
8.1.50.0070.00017.34
8.1.40.0040.00417.50
8.1.30.0050.00317.60
8.1.20.0040.00417.44
8.1.10.0040.00417.44
8.1.00.0070.00017.25
8.0.300.0000.00719.79
8.0.290.0070.00016.63
8.0.280.0070.00018.38
8.0.270.0000.00717.22
8.0.260.0030.00316.69
8.0.250.0040.00416.92
8.0.240.0000.00816.88
8.0.230.0030.00316.80
8.0.220.0000.00716.86
8.0.210.0040.00416.77
8.0.200.0000.00616.79
8.0.190.0000.00816.93
8.0.180.0030.00616.79
8.0.170.0040.00416.89
8.0.160.0030.00316.82
8.0.150.0030.00616.61
8.0.140.0030.00416.75
8.0.130.0050.00013.23
8.0.120.0070.00016.82
8.0.110.0000.00716.91
8.0.100.0000.00716.62
8.0.90.0000.00716.80
8.0.80.0090.00616.79
8.0.70.0000.00716.75
8.0.60.0030.00616.70
8.0.50.0030.00716.83
8.0.30.0110.00416.98
8.0.20.0110.01216.83
8.0.10.0000.00816.90
8.0.00.0120.00816.65
7.4.330.0050.00013.00
7.4.320.0060.00016.56
7.4.300.0030.00316.59
7.4.290.0000.00816.54
7.4.280.0040.00416.47
7.4.270.0030.00316.36
7.4.260.0030.00313.19
7.4.250.0080.00016.46
7.4.240.0000.00716.56
7.4.230.0000.00716.38
7.4.220.0120.00616.45
7.4.210.0110.00416.50
7.4.200.0040.00416.64
7.4.190.0070.00016.68
7.4.160.0030.01216.61
7.4.150.0130.01016.50
7.4.140.0090.00916.37
7.4.130.0060.00916.41
7.4.120.0110.00716.36
7.4.110.0100.00616.35
7.4.100.0090.00916.27
7.4.90.0070.01016.49
7.4.80.0110.00719.39
7.4.70.0140.00316.27
7.4.60.0130.00616.46
7.4.50.0040.00416.31
7.4.40.0060.00916.50
7.4.30.0090.01016.27
7.4.00.0100.00614.89
7.3.330.0050.00013.13
7.3.320.0000.00613.09
7.3.310.0070.00016.29
7.3.300.0070.00016.20
7.3.290.0070.00716.16
7.3.280.0120.00716.19
7.3.270.0140.00416.11
7.3.260.0100.00716.24
7.3.250.0120.00916.40
7.3.240.0140.00316.21
7.3.230.0120.00316.30
7.3.210.0150.00316.41
7.3.200.0070.01416.14
7.3.190.0130.00316.08
7.3.180.0140.00716.14
7.3.170.0100.01316.43
7.3.160.0130.00316.30
7.3.120.0070.01014.68
7.3.10.0000.01116.29
7.3.00.0100.00316.34
7.2.330.0130.00316.50
7.2.320.0130.00416.46
7.2.310.0030.01516.61
7.2.300.0060.01016.50
7.2.290.0090.00916.32
7.2.130.0000.01016.70
7.2.120.0030.01016.86
7.2.110.0040.00816.87
7.2.100.0070.00716.95
7.2.90.0000.01216.68
7.2.80.0070.00716.83
7.2.70.0040.00816.57
7.2.60.0100.00316.69
7.2.50.0080.00416.44
7.2.40.0090.00316.38
7.2.30.0060.00616.64
7.2.20.0040.01116.95
7.2.10.0060.00916.41
7.2.00.0070.00617.76
7.1.250.0040.00815.70
7.1.70.0030.00617.11
7.1.60.0060.01919.31
7.1.50.0040.01816.99
7.1.00.0070.05722.51
7.0.200.0000.00916.78
7.0.140.0030.06722.11
7.0.120.0070.07322.15
7.0.60.0100.06019.91
7.0.50.0100.03317.86
7.0.40.0130.08020.23
7.0.30.0270.07320.30
7.0.20.0230.07720.09
7.0.10.0170.05320.07
7.0.00.0070.07720.20
5.6.280.0030.07021.06
5.6.210.0230.06320.69
5.6.200.0130.05718.29
5.6.190.0000.09720.47
5.6.180.3000.04020.75
5.6.170.0170.04720.39
5.6.160.0030.04720.44
5.6.150.0100.07318.14
5.6.140.0100.04718.18
5.6.130.0070.06018.19
5.6.120.0200.06720.94
5.6.110.0000.04320.99
5.6.100.0070.04720.97
5.6.90.0130.08321.09
5.6.80.0100.08020.39
5.6.70.4630.04020.36
5.5.350.0030.08020.29
5.5.340.0030.05018.00
5.5.330.0100.08020.21
5.5.320.0330.06320.34
5.5.310.0330.04020.50
5.5.300.0130.07018.04
5.5.290.0030.05317.94
5.5.280.0130.03320.88
5.5.270.0030.06020.64
5.5.260.0170.07320.88
5.5.250.0070.07320.64
5.5.240.0070.06320.33
5.4.450.0200.07019.50
5.4.440.0130.07719.57
5.4.430.0100.07719.44
5.4.420.0070.08019.46
5.4.410.0170.07319.05
5.4.400.0100.05718.98
5.4.390.0100.06319.14
5.4.380.0030.06019.24
5.4.370.0000.04318.85
5.4.360.0100.03718.87
5.4.350.0100.07318.87
5.4.340.0200.07018.92
5.4.320.0170.04719.20
5.4.310.0100.06318.98
5.4.300.0100.07719.00
5.4.290.0130.05719.25
5.4.280.0130.07319.20
5.4.270.0070.04319.20
5.4.260.0030.04718.95
5.4.250.0030.04718.97
5.4.240.0030.07718.91
5.4.230.0070.06318.84
5.4.220.0170.06018.86
5.4.210.0070.07719.14
5.4.200.0100.06018.84
5.4.190.0100.07319.14
5.4.180.0070.06318.99
5.4.170.0030.08319.11
5.4.160.0070.07019.21
5.4.150.0070.04319.13
5.4.140.0130.07016.41
5.4.130.0130.07016.37
5.4.120.0030.04316.40
5.4.110.0100.07316.53
5.4.100.0070.07716.41
5.4.90.0070.07016.39
5.4.80.0170.06316.65
5.4.70.0170.06716.39
5.4.60.0000.07316.41
5.4.50.0030.06016.38
5.4.40.0030.05016.36
5.4.30.0100.07016.44
5.4.20.0030.07716.50
5.4.10.0130.06716.64
5.4.00.0100.06315.80
5.3.290.0130.05714.65
5.3.280.0100.06314.66
5.3.270.0130.07014.63
5.3.260.0030.04314.48
5.3.250.0030.08014.59
5.3.240.0070.07014.64
5.3.230.0130.07014.64
5.3.220.0230.05714.61
5.3.210.0070.06714.62
5.3.200.0100.07014.61
5.3.190.0100.06714.57
5.3.180.0070.05714.48
5.3.170.0000.07714.48
5.3.160.0130.05014.58
5.3.150.0000.07314.59
5.3.140.0070.06714.59
5.3.130.0030.07314.54
5.3.120.0100.06714.46
5.3.110.0000.05714.61
5.3.100.0030.04314.05
5.3.90.0100.07714.17
5.3.80.0000.08014.02
5.3.70.0070.08014.03
5.3.60.0030.08013.89
5.3.50.0070.07714.01
5.3.40.0070.05713.98
5.3.30.0030.05313.85
5.3.20.0100.07013.57
5.3.10.0070.04713.64
5.3.00.0100.05713.55
5.2.170.0030.06711.15
5.2.160.0070.06011.13
5.2.150.0000.06311.06
5.2.140.0100.04011.31
5.2.130.0030.06311.13
5.2.120.0070.05711.26
5.2.110.0030.05011.16
5.2.100.0070.06011.05
5.2.90.0030.04311.13
5.2.80.0070.03711.05
5.2.70.0030.03011.15
5.2.60.0030.03711.04
5.2.50.0000.03010.93
5.2.40.0000.03310.93
5.2.30.0030.03311.04
5.2.20.0000.03310.96
5.2.10.0070.02710.80
5.2.00.0000.03010.59
5.1.60.0030.0279.99
5.1.50.0000.0279.99
5.1.40.0070.0209.96
5.1.30.0030.02710.21
5.1.20.0000.02710.49
5.1.10.0000.02710.11
5.1.00.0030.0239.99
5.0.50.0000.0239.69
5.0.40.0000.0209.69
5.0.30.0000.0309.69
5.0.20.0070.0139.69
5.0.10.0070.0139.69
5.0.00.0000.0309.69
4.4.90.0000.0239.69
4.4.80.0030.0139.69
4.4.70.0000.0179.69
4.4.60.0000.0179.69
4.4.50.0000.0179.69
4.4.40.0000.0339.69
4.4.30.0030.0139.69
4.4.20.0000.0209.69
4.4.10.0030.0139.69
4.4.00.0000.0239.69
4.3.110.0000.0179.69
4.3.100.0000.0179.69
4.3.90.0000.0179.69
4.3.80.0030.0239.69
4.3.70.0000.0139.69
4.3.60.0000.0179.69
4.3.50.0000.0179.69
4.3.40.0030.0209.69
4.3.30.0000.0139.69
4.3.20.0000.0139.69
4.3.10.0000.0179.69
4.3.00.0030.0109.69

preferences:
65.02 ms | 401 KiB | 5 Q