3v4l.org

run code in 300+ PHP versions simultaneously
<?php fgets(STDIN); $numbers = explode(' ', rtrim(fgets(STDIN))); $valuePerWife = array_sum($numbers) / 2; // Taken from here: http://stackoverflow.com/a/13194803/603003 // Credits to dAngelov: http://stackoverflow.com/users/955185/dangelov function pc_permute($items, $perms = array( )) { if (empty($items)) { $return = array($perms); } else { $return = array(); for ($i = count($items) - 1; $i >= 0; --$i) { $newitems = $items; $newperms = $perms; list($foo) = array_splice($newitems, $i, 1); array_unshift($newperms, $foo); $return = array_merge($return, pc_permute($newitems, $newperms)); } } return $return; } foreach (pc_permute($numbers) as $permutation) { $sum = 0; $rest = []; for ($i=0; $i<count($permutation); $i++) { $sum += $permutation[$i]; if ($sum == $valuePerWife) { $rest = array_slice($permutation, $i + 1); break; } } if (array_sum($rest) == $valuePerWife) { echo implode(' ', array_slice($permutation, 0, $i + 1)), "\n"; echo implode(' ', array_slice($permutation, $i + 1)), "\n"; echo 'diff=0'; exit; } } exit('DIDNT FOUND ANY COMBINATION!');

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.0070.01118.31
8.3.50.0100.01021.27
8.3.40.0070.01118.96
8.3.30.0090.00919.17
8.3.20.0050.00220.21
8.3.10.0040.00421.82
8.3.00.0050.00322.22
8.2.180.0110.00418.55
8.2.170.0110.00722.96
8.2.160.0140.00019.16
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0150.00326.16
8.2.120.0000.01017.60
8.2.110.0090.00022.25
8.2.100.0090.00617.84
8.2.90.0050.00319.39
8.2.80.0050.00318.03
8.2.70.0000.00917.63
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0040.00418.16
8.2.30.0040.00418.15
8.2.20.0040.00417.68
8.2.10.0030.00517.89
8.2.00.0000.00917.73
8.1.280.0140.00325.92
8.1.270.0040.00422.14
8.1.260.0090.00026.35
8.1.250.0000.00828.09
8.1.240.0070.00323.84
8.1.230.0080.00418.98
8.1.220.0030.00617.78
8.1.210.0000.00818.77
8.1.200.0000.01017.35
8.1.190.0040.00417.55
8.1.180.0040.00418.75
8.1.170.0030.00618.62
8.1.160.0040.00422.16
8.1.150.0030.00518.70
8.1.140.0040.00417.43
8.1.130.0000.00817.83
8.1.120.0040.00417.52
8.1.110.0000.00717.46
8.1.100.0050.00217.37
8.1.90.0040.00417.54
8.1.80.0000.00717.37
8.1.70.0040.00417.42
8.1.60.0000.00717.57
8.1.50.0040.00417.43
8.1.40.0000.00817.46
8.1.30.0040.00417.66
8.1.20.0000.00817.67
8.1.10.0100.00017.46
8.1.00.0030.00517.58
8.0.300.0030.00518.77
8.0.290.0000.00817.03
8.0.280.0000.00718.42
8.0.270.0070.00017.35
8.0.260.0030.00316.90
8.0.250.0030.00316.92
8.0.240.0040.00716.93
8.0.230.0000.00717.04
8.0.220.0030.00316.87
8.0.210.0030.00316.86
8.0.200.0040.00416.92
8.0.190.0070.00017.05
8.0.180.0040.00417.05
8.0.170.0060.00316.91
8.0.160.0040.00416.95
8.0.150.0050.00216.97
8.0.140.0100.00016.96
8.0.130.0030.00313.39
8.0.120.0000.00816.82
8.0.110.0020.00517.04
8.0.100.0040.00416.97
8.0.90.0040.00417.00
8.0.80.0080.00716.89
8.0.70.0000.00716.91
8.0.60.0040.00416.93
8.0.50.0000.00716.80
8.0.30.0030.01516.96
8.0.20.0050.01317.40
8.0.10.0040.00416.99
8.0.00.0120.00916.64
7.4.330.0050.00015.00
7.4.320.0030.00316.54
7.4.300.0000.00616.63
7.4.290.0030.00316.47
7.4.280.0050.00216.56
7.4.270.0000.00716.43
7.4.260.0000.00716.62
7.4.250.0080.00016.57
7.4.240.0020.00516.65
7.4.230.0040.00416.46
7.4.220.0070.01116.64
7.4.210.0080.00716.57
7.4.200.0050.00316.66
7.4.190.0000.00716.75
7.4.160.0060.00916.48
7.4.150.0070.01417.40
7.4.140.0090.00817.86
7.4.130.0150.00616.66
7.4.120.0090.00816.66
7.4.110.0100.00716.64
7.4.100.0120.00616.64
7.4.90.0100.00716.44
7.4.80.0070.01019.39
7.4.70.0070.01416.38
7.4.60.0070.01016.46
7.4.50.0040.00416.36
7.4.40.0060.00622.77
7.4.30.0070.01016.40
7.4.10.0040.01515.19
7.4.00.0120.00615.25
7.3.330.0020.00213.29
7.3.320.0030.00313.21
7.3.310.0030.00316.34
7.3.300.0030.00316.32
7.3.290.0070.00716.47
7.3.280.0040.01116.42
7.3.270.0110.00717.40
7.3.260.0080.00816.71
7.3.250.0160.00516.65
7.3.240.0200.00316.52
7.3.230.0070.01016.61
7.3.210.0060.01216.52
7.3.200.0130.00316.47
7.3.190.0040.01816.52
7.3.180.0160.00316.57
7.3.170.0110.00516.60
7.3.160.0090.00616.45
7.3.130.0110.00714.57
7.3.120.0040.01014.76
7.3.110.0060.01314.59
7.3.100.0040.01114.78
7.3.90.0060.00914.77
7.3.80.0070.00714.71
7.3.70.0040.01115.06
7.3.60.0040.01114.67
7.3.50.0060.00914.88
7.3.40.0080.00814.86
7.3.30.0030.01014.92
7.3.20.0000.01416.72
7.3.10.0100.00316.75
7.3.00.0080.00416.88
7.2.330.0090.00916.44
7.2.320.0060.01616.84
7.2.310.0070.01116.79
7.2.300.0100.00716.87
7.2.290.0080.00816.72
7.2.260.0070.00715.03
7.2.250.0150.00315.12
7.2.240.0130.00015.21
7.2.230.0100.01014.97
7.2.220.0070.01015.29
7.2.210.0060.00614.79
7.2.200.0070.00415.14
7.2.190.0060.01014.83
7.2.180.0060.00915.05
7.2.170.0070.00715.30
7.2.160.0000.01414.90
7.2.150.0140.00316.92
7.2.140.0070.00716.95
7.2.130.0040.00816.71
7.2.120.0030.00816.69
7.2.110.0000.01216.89
7.2.100.0140.00017.00
7.2.90.0130.00716.72
7.2.80.0100.01016.81
7.2.70.0040.00717.10
7.2.60.0090.00416.91
7.2.50.0040.01117.05
7.2.40.0050.00516.93
7.2.30.0000.01216.97
7.2.20.0000.01016.84
7.2.10.0000.01117.00
7.2.00.0030.01118.10
7.1.330.0030.01015.75
7.1.320.0060.01315.86
7.1.310.0000.01315.92
7.1.300.0070.00415.90
7.1.290.0030.00715.73
7.1.280.0140.00015.61
7.1.270.0040.00715.84
7.1.260.0030.00516.02
7.1.250.0110.00315.86
7.1.240.0030.01015.63
7.1.230.0070.00715.87
7.1.220.0060.00615.63
7.1.210.0060.01315.57
7.1.200.0070.00515.77
7.1.190.0080.00815.55
7.1.180.0100.00615.80
7.1.170.0000.01315.49
7.1.160.0100.00316.00
7.1.150.0040.01115.72
7.1.140.0060.00915.71
7.1.130.0000.01115.86
7.1.120.0030.01315.58
7.1.110.0030.00615.71
7.1.100.0050.00817.02
7.1.90.0060.00316.06
7.1.80.0000.00815.78
7.1.70.0050.00516.44
7.1.60.0080.01017.87
7.1.50.0080.00916.46
7.1.40.0070.00715.65
7.1.30.0030.00915.63
7.1.20.0040.00815.92
7.1.10.0070.00315.87
7.1.00.0060.01819.04
7.0.330.0000.01315.48
7.0.320.0000.01415.38
7.0.310.0000.00915.53
7.0.300.0070.00415.18
7.0.290.0090.00015.61
7.0.280.0000.01415.25
7.0.270.0000.01415.60
7.0.260.0030.01315.44
7.0.250.0030.00715.63
7.0.240.0100.00315.44
7.0.230.0000.01515.23
7.0.220.0120.00415.57
7.0.210.0000.01415.25
7.0.200.0050.00416.10
7.0.190.0080.00415.41
7.0.180.0070.00315.44
7.0.170.0000.01515.61
7.0.160.0030.00615.59
7.0.150.0060.00615.42
7.0.140.0090.03518.64
7.0.130.0030.00915.38
7.0.120.0040.00415.58
7.0.110.0030.01315.56
7.0.100.0030.00515.57
7.0.90.0030.00615.42
7.0.80.0060.00615.27
7.0.70.1540.02217.62
7.0.60.0070.04217.59
7.0.50.0050.03716.65
7.0.40.0080.05016.80
7.0.30.0200.03716.77
7.0.20.0210.03516.84
7.0.10.0210.04216.83
7.0.00.0110.01816.77
5.6.400.0080.00414.30
5.6.390.0030.01414.67
5.6.380.0070.00714.51
5.6.370.0030.00714.06
5.6.360.0060.00914.59
5.6.350.0000.01214.35
5.6.340.0090.00614.37
5.6.330.0070.00714.51
5.6.320.0040.01114.59
5.6.310.0040.01114.78
5.6.300.0030.00614.74
5.6.290.0000.01014.54
5.6.280.0070.04017.77
5.6.270.0070.00714.74
5.6.260.0040.00814.55
5.6.250.0000.01114.57
5.6.240.0060.00614.36
5.6.230.0080.00414.45
5.6.220.0090.00914.41
5.6.210.0070.04317.53
5.6.200.0090.04316.24
5.6.190.0100.04517.40
5.6.180.0150.04217.42
5.6.170.0210.02317.40
5.6.160.0080.04217.30
5.6.150.0070.04216.40
5.6.140.0020.02716.28
5.6.130.0030.02816.33
5.6.120.0110.04017.81
5.6.110.0090.04017.75
5.6.100.0070.04217.62
5.6.90.0100.04217.66
5.6.80.0080.03517.22
5.6.70.0120.01917.30
5.6.60.0030.00714.34
5.6.50.0100.00713.95
5.6.40.0030.00614.48
5.6.30.0030.01314.37
5.6.20.0090.00614.37
5.6.10.0040.00814.03
5.6.00.0060.00314.34
5.5.380.0060.00314.13
5.5.370.0040.01114.34
5.5.360.0070.00314.29
5.5.350.0050.04717.50
5.5.340.0110.04016.28
5.5.330.0090.03517.19
5.5.320.0090.02717.21
5.5.310.0190.03317.44
5.5.300.0080.02016.05
5.5.290.0080.02816.09
5.5.280.0090.04017.66
5.5.270.0070.02517.67
5.5.260.0090.04217.51
5.5.250.0090.02217.46
5.5.240.0060.02317.27
5.5.230.0070.00714.30
5.5.220.0070.01014.68
5.5.210.0000.01414.41
5.5.200.0000.01114.49
5.5.190.0030.01014.22
5.5.180.0040.00414.16
5.5.170.0100.00714.64
5.5.160.0100.00314.61
5.5.150.0030.01013.90
5.5.140.0040.00814.55
5.5.130.0100.00014.32
5.5.120.0040.01114.48
5.5.110.0030.00614.65
5.5.100.0060.01214.08
5.5.90.0000.01814.02
5.5.80.0000.01514.19
5.5.70.0070.00714.35
5.5.60.0060.00614.29
5.5.50.0030.01314.39
5.5.40.0060.00614.49
5.5.30.0070.00714.24
5.5.20.0030.00614.35
5.5.10.0080.00514.39
5.5.00.0070.01013.85
5.4.450.0300.03715.46
5.4.440.0540.02015.46
5.4.430.0430.03415.25
5.4.420.0580.02515.33
5.4.410.0400.03715.11
5.4.400.0470.03014.98
5.4.390.0470.02915.07
5.4.380.0080.03514.81
5.4.370.0130.03014.92
5.4.360.0200.03014.89
5.4.350.0050.02011.54
5.4.340.0080.02211.69
5.4.330.0000.01011.10
5.4.320.0040.02511.89
5.4.310.0030.02411.77
5.4.300.0070.02211.85
5.4.290.0060.02811.96
5.4.280.0040.02411.74
5.4.270.0070.02011.80
5.4.260.0060.04515.00
5.4.250.0050.03315.02
5.4.240.0080.02814.96
5.4.230.0110.02815.21
5.4.220.0030.03715.06
5.4.210.0070.02914.83
5.4.200.0130.03015.01
5.4.190.0060.04315.15
5.4.180.0080.03414.84
5.4.170.0040.03215.02
5.4.160.0070.03014.99
5.4.150.0080.03815.16
5.4.140.0030.03213.65
5.4.130.0170.02713.81
5.4.120.0070.02813.91
5.4.110.0050.03013.78
5.4.100.0030.02813.92
5.4.90.0070.02513.90
5.4.80.0050.03413.71
5.4.70.0090.03113.88
5.4.60.0050.03813.65
5.4.50.0100.02413.82
5.4.40.0050.03313.80
5.4.30.0090.02813.91
5.4.20.0070.03513.71
5.4.10.0070.03213.79
5.4.00.0090.02413.44
5.3.290.0030.02811.57
5.3.280.0050.03812.53
5.3.270.0030.03312.50
5.3.260.0070.02712.56
5.3.250.0070.03612.48
5.3.240.0040.03012.41
5.3.230.0070.03012.37
5.3.220.0100.03512.36
5.3.210.0060.02812.45
5.3.200.0080.03512.46
5.3.190.0090.02412.35
5.3.180.0050.02712.51
5.3.170.0100.03512.56
5.3.160.0090.04012.59
5.3.150.0150.02812.44
5.3.140.0090.02712.52
5.3.130.0130.02512.43
5.3.120.0030.04712.34
5.3.110.0070.03812.49
5.3.100.0100.02512.13
5.3.90.0070.03512.15
5.3.80.0080.02512.15
5.3.70.0100.03211.93
5.3.60.0050.02712.10
5.3.50.0100.03012.14
5.3.40.0070.03712.13
5.3.30.0050.02712.08
5.3.20.0050.02612.01
5.3.10.0070.02511.89
5.3.00.0070.02611.87
5.2.170.0100.06011.23
5.2.160.0000.04711.23
5.2.150.0030.04311.15
5.2.140.0070.04011.13
5.2.130.0070.04311.09
5.2.120.0130.04711.32
5.2.110.0070.04311.19
5.2.100.0030.04311.16
5.2.90.0000.04311.18
5.2.80.0070.04011.07
5.2.70.0030.05010.92
5.2.60.0100.04311.14
5.2.50.0030.04311.03
5.2.40.0130.03711.10
5.2.30.0030.06010.89
5.2.20.0000.04310.86
5.2.10.0100.04010.81
5.2.00.0000.04710.81
5.1.60.0000.04010.24
5.1.50.0100.03710.16
5.1.40.0100.0309.95
5.1.30.0130.03710.24
5.1.20.0070.03310.45
5.1.10.0030.04010.14
5.1.00.0100.04310.27
5.0.50.0030.0308.51
5.0.40.0130.0338.48
5.0.30.0070.0438.14
5.0.20.0070.0238.25
5.0.10.0030.0308.42
5.0.00.0100.0508.21
4.4.90.0070.0177.45
4.4.80.0070.0277.45
4.4.70.0070.0177.45
4.4.60.0030.0277.45
4.4.50.0000.0277.45
4.4.40.0000.0407.45
4.4.30.0000.0237.45
4.4.20.0000.0237.45
4.4.10.0100.0137.45
4.4.00.0030.0377.45
4.3.110.0000.0337.45
4.3.100.0100.0137.45
4.3.90.0100.0137.45
4.3.80.0000.0377.45
4.3.70.0030.0277.45
4.3.60.0100.0137.45
4.3.50.0070.0207.45
4.3.40.0030.0337.45
4.3.30.0130.0177.45
4.3.20.0000.0307.45
4.3.10.0000.0237.45
4.3.00.0170.0277.00

preferences:
43.32 ms | 401 KiB | 5 Q