3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 1234455; $b = 54456; function digits_in_both($x, $y) { $in_both = []; $split_y = str_split($y); foreach(str_split($x) as $n) { $key = array_search($n, $split_y); if($key !== false) { $in_both[] = $n; unset($split_y[$key]); } } return $in_both; } $in_both = digits_in_both(123445, 54456); var_export($in_both); var_dump(count($in_both));

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.00616.62
8.3.60.0100.01016.73
8.3.50.0110.00416.57
8.3.40.0060.01318.92
8.3.30.0150.00018.67
8.3.20.0040.00421.88
8.3.10.0040.00421.88
8.3.00.0000.00817.89
8.2.180.0120.00318.29
8.2.170.0090.00622.96
8.2.160.0110.00422.13
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0050.00319.17
8.2.120.0040.00426.35
8.2.110.0060.00319.41
8.2.100.0120.00017.91
8.2.90.0040.00417.88
8.2.80.0040.00418.88
8.2.70.0050.00317.91
8.2.60.0040.00418.05
8.2.50.0030.00618.22
8.2.40.0050.00320.66
8.2.30.0040.00419.51
8.2.20.0040.00418.02
8.2.10.0030.00518.04
8.2.00.0000.00718.21
8.1.280.0100.01325.92
8.1.270.0080.00022.25
8.1.260.0080.00826.35
8.1.250.0060.00328.09
8.1.240.0000.00822.23
8.1.230.0080.00322.14
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00517.11
8.1.190.0000.00817.23
8.1.180.0070.00018.10
8.1.170.0000.00918.96
8.1.160.0000.00718.92
8.1.150.0000.00719.05
8.1.140.0030.00617.66
8.1.130.0000.00818.88
8.1.120.0000.00717.44
8.1.110.0040.00417.45
8.1.100.0040.00417.38
8.1.90.0030.00617.47
8.1.80.0050.00517.34
8.1.70.0020.00517.47
8.1.60.0000.00917.47
8.1.50.0000.00917.52
8.1.40.0030.00517.53
8.1.30.0020.00517.67
8.1.20.0040.00417.59
8.1.10.0080.00017.35
8.1.00.0030.00617.27
8.0.300.0050.00218.77
8.0.290.0000.00716.63
8.0.280.0070.00018.45
8.0.270.0070.00017.19
8.0.260.0030.00319.04
8.0.250.0100.00016.96
8.0.240.0040.00416.94
8.0.230.0070.00016.81
8.0.220.0030.00616.86
8.0.210.0050.00216.93
8.0.200.0070.00016.95
8.0.190.0070.00016.84
8.0.180.0040.00416.82
8.0.170.0040.00416.89
8.0.160.0000.00716.96
8.0.150.0000.00716.86
8.0.140.0070.00016.86
8.0.130.0000.00613.34
8.0.120.0040.00416.73
8.0.110.0000.00816.86
8.0.100.0030.00516.88
8.0.90.0040.00416.79
8.0.80.0040.01116.95
8.0.70.0000.00816.78
8.0.60.0040.00416.84
8.0.50.0000.00716.71
8.0.30.0060.01116.80
8.0.20.0100.01017.40
8.0.10.0070.00016.96
8.0.00.0110.00616.84
7.4.330.0000.00515.55
7.4.320.0000.00616.61
7.4.300.0030.00316.64
7.4.290.0070.00016.45
7.4.280.0040.00416.58
7.4.270.0070.00016.48
7.4.260.0070.00016.48
7.4.250.0030.00316.47
7.4.240.0000.00716.56
7.4.230.0070.00016.53
7.4.220.0080.00016.50
7.4.210.0080.01116.65
7.4.200.0070.00016.48
7.4.160.0110.01016.54
7.4.140.0100.00717.86
7.4.130.0060.01616.40
7.4.120.0120.00816.59
7.4.110.0030.01316.52
7.4.100.0130.00316.55
7.4.90.0100.00716.52
7.4.80.0090.00919.39
7.4.70.0070.01016.35
7.4.60.0030.01316.64
7.4.50.0000.01416.20
7.4.40.0110.00516.35
7.4.00.0040.01114.68
7.3.330.0000.00513.14
7.3.320.0000.00513.38
7.3.310.0030.00316.45
7.3.300.0030.00316.33
7.3.290.0000.00616.36
7.3.280.0070.00816.37
7.3.260.0110.01116.40
7.3.240.0050.01216.29
7.3.230.0060.01216.57
7.3.210.0120.00416.42
7.3.200.0070.01016.52
7.3.190.0000.01716.70
7.3.180.0090.00616.47
7.3.170.0130.00316.65
7.3.160.0120.00916.37
7.2.330.0150.00316.64
7.2.320.0070.01416.80
7.2.310.0120.00616.85
7.2.300.0120.00916.75
7.2.290.0050.01316.79
7.2.60.0070.00717.00
7.2.50.0030.01016.90
7.2.40.1850.01018.11
7.2.30.1630.01217.77
7.2.20.1300.00918.05
7.2.10.1530.01317.90
7.2.00.1180.01018.05
7.1.200.0030.00715.90
7.1.160.1550.01416.73
7.1.150.1660.01416.98
7.1.140.1260.01316.67
7.1.130.1520.01116.69
7.1.120.1230.01217.14
7.1.110.1310.00916.28
7.1.100.2050.01515.97
7.1.90.2110.01115.70
7.1.80.2130.01016.17
7.1.70.2560.00515.43
7.1.60.1950.00833.31
7.1.50.2770.01432.94
7.1.40.3470.01732.66
7.1.30.2920.01132.71
7.1.20.2410.01632.73
7.1.10.2370.01014.79
7.1.00.1190.00914.93

preferences:
64.21 ms | 401 KiB | 5 Q