3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check_unique() { $seen = new ArrayObject(); return function ($value) use ($seen) { if (in_array($value, (array)$seen)) { return false; } $seen[] = $value; return true; }; } const ITEMS = 10000; $array = array_merge(range(1, ITEMS, 3), range(1, ITEMS, 2)); echo "started with ", count($array), " items\n"; $check_unique = check_unique(); $unique = []; echo "memory usage ", memory_get_peak_usage(), "\n"; $time = -microtime(true); foreach ($array as $value) { if ($check_unique($value)) { $unique[] = $value; } } $time += microtime(true); echo "memory usage ", memory_get_peak_usage(), "\n"; echo "took $time sec\n"; echo "finished with ", count($unique), " items\n";

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)
7.4.10.0070.42516.23
7.4.00.0100.40616.01
7.3.130.0070.33516.15
7.3.120.0100.24415.94
7.3.110.0070.33416.09
7.3.100.0000.23116.09
7.3.90.0030.31015.81
7.3.80.0100.21815.80
7.3.70.0030.21715.85
7.3.60.0030.23415.55
7.3.50.0000.26315.89
7.3.40.0070.23615.66
7.3.30.0100.24415.98
7.3.20.0030.23316.70
7.3.10.0070.29316.41
7.3.00.0030.28716.51
7.2.260.0070.27116.04
7.2.250.0070.34515.72
7.2.240.0070.26015.71
7.2.230.0100.24116.05
7.2.220.0130.24516.04
7.2.210.0030.29916.04
7.2.200.0030.27316.27
7.2.190.0100.27716.27
7.2.180.0030.24416.22
7.2.170.0030.22916.01
7.2.160.0030.24116.15
7.2.150.0030.27017.06
7.2.140.0030.30117.14
7.2.130.0070.27916.76
7.2.120.0100.24116.88
7.2.110.0030.22416.80
7.2.100.0030.33716.99
7.2.90.0030.27317.08
7.2.80.0030.33517.01
7.2.70.0070.31517.14
7.2.60.0000.30916.62
7.2.50.0070.22416.84
7.2.40.0070.33516.96
7.2.30.0000.23017.02
7.2.20.0000.24716.88
7.2.10.0030.31716.84
7.2.00.0100.29017.90
7.1.330.0000.18715.53
7.1.320.0070.18715.91
7.1.310.0030.20015.91
7.1.300.0030.21415.64
7.1.290.0070.22215.84
7.1.280.0000.18815.91
7.1.270.0070.18615.94
7.1.260.0030.19315.80
7.1.250.0000.20015.78
7.1.240.0000.18915.98
7.1.230.0070.21115.84
7.1.220.0070.18215.71
7.1.210.0130.20216.00
7.1.200.0130.19415.97
7.1.190.0070.19015.95
7.1.180.0000.27615.68
7.1.170.0030.27415.61
7.1.160.0030.27215.77
7.1.150.0070.20515.57
7.1.140.0070.27815.93
7.1.130.0070.21615.92
7.1.120.0030.27315.95
7.1.110.0030.25015.94
7.1.100.0000.21515.91
7.1.90.0070.27215.83
7.1.80.0030.19915.70
7.1.70.0050.26016.47
7.1.60.0480.19316.60
7.1.50.0050.22116.45
7.1.40.0030.27015.87
7.1.30.0030.19215.92
7.1.20.0030.18115.71
7.1.10.0070.26715.68
7.1.00.0080.22519.02
7.0.330.0030.18615.35
7.0.320.0000.18115.41
7.0.310.0030.21715.36
7.0.300.0030.20815.59
7.0.290.0070.20515.47
7.0.280.0100.26315.55
7.0.270.0070.22315.46
7.0.260.0000.25415.49
7.0.250.0000.27415.49
7.0.240.0100.23615.54
7.0.230.0070.19315.57
7.0.220.0070.19315.09
7.0.210.0070.27015.40
7.0.200.0050.25315.95
7.0.190.0070.25415.45
7.0.180.0030.18315.14
7.0.170.0030.18315.48
7.0.160.0030.19115.34
7.0.150.0030.26915.36
7.0.140.0070.26218.72
7.0.130.0070.27315.59
7.0.120.0090.25315.53
7.0.110.0030.24615.57
7.0.100.0070.27215.21
7.0.90.0000.20715.49
7.0.80.0070.18815.47
7.0.70.1800.23418.29
7.0.60.0080.27718.04
7.0.50.0050.27417.21
7.0.40.0050.27516.76
7.0.30.0150.24916.87
7.0.20.0180.20716.82
7.0.10.0180.20416.81
7.0.00.0030.27416.81
5.6.400.0202.30617.45
5.6.390.0072.49217.60
5.6.380.0272.43717.45
5.6.370.0202.34717.27
5.6.360.0132.34617.39
5.6.350.0202.41117.42
5.6.340.0202.39917.68
5.6.330.0302.44617.05
5.6.320.0302.40917.68
5.6.310.0272.35117.66
5.6.300.0202.47217.73
5.6.290.0072.49017.76
5.6.280.0032.05620.88
5.6.270.0032.49317.30
5.6.260.0102.48617.70
5.6.250.0002.49517.49
5.6.240.0172.46817.61
5.6.230.0102.48417.70
5.6.220.0072.48617.54
5.6.210.0082.23120.49
5.6.200.0052.23919.18
5.6.190.0152.22020.22
5.6.180.0172.23220.26
5.6.170.0232.38320.45
5.6.160.0232.24520.22
5.6.150.0152.42319.11
5.6.140.0152.18819.30
5.6.130.0082.26319.29
5.6.120.0072.27820.90
5.6.110.0072.28420.78
5.6.100.0152.23720.73
5.6.90.0082.20020.88
5.6.80.0102.22020.28
5.6.70.0202.19720.32
5.6.60.0032.49217.38
5.6.50.0202.46417.49
5.6.40.0072.48917.54
5.6.30.0202.46117.14
5.6.20.0072.48917.04
5.6.10.0122.47217.38
5.6.00.0032.48817.40
5.5.380.0132.47217.43
5.5.370.0002.49117.54
5.5.360.0132.48017.75
5.5.350.0122.19620.22
5.5.340.0032.23819.09
5.5.330.0152.28820.30
5.5.320.0072.27620.18
5.5.310.0222.17320.16
5.5.300.0132.40919.19
5.5.290.0082.27619.25
5.5.280.0122.27920.79
5.5.270.0182.22920.46
5.5.260.0082.31220.38
5.5.250.0102.25720.49
5.5.240.0152.27620.25
5.5.230.0132.47717.60
5.5.220.0102.48217.12
5.5.210.0092.48017.32
5.5.200.0122.47417.38
5.5.190.0072.48617.48
5.5.180.0102.47317.35
5.5.170.0132.48317.46
5.5.160.0132.48017.38
5.5.150.0072.49017.16
5.5.140.0102.48317.33
5.5.130.0032.49017.35
5.5.120.0102.48417.13
5.5.110.0072.48917.41
5.5.100.0032.49117.34
5.5.90.0172.47617.27
5.5.80.0032.49117.34
5.5.70.0262.45817.36
5.5.60.0072.49017.31
5.5.50.0062.48217.14
5.5.40.0202.47617.17
5.5.30.0072.48717.19
5.5.20.0072.49017.14
5.5.10.0102.48617.32
5.5.00.0032.48717.34
5.4.450.0252.44818.38
5.4.440.0182.45418.29
5.4.430.0222.44018.10
5.4.420.0202.45518.21
5.4.410.0222.44518.11
5.4.400.0152.48118.07
5.4.390.0202.45718.01
5.4.380.0102.46518.02
5.4.370.0172.30017.75
5.4.360.0202.22317.95
5.4.350.0172.44118.05
5.4.340.0122.45517.90
5.4.330.0032.49314.20
5.4.320.0182.12114.79
5.4.310.0142.11814.79
5.4.300.0432.07614.81
5.4.290.0132.12114.60
5.4.280.0182.13314.79
5.4.270.0112.13414.72
5.4.260.0202.30117.83
5.4.250.0122.29618.01
5.4.240.0222.28617.91
5.4.230.0192.40017.65
5.4.220.0072.45117.70
5.4.210.0182.43817.80
5.4.200.0202.41117.94
5.4.190.0272.34217.90
5.4.180.0102.25517.83
5.4.170.0182.24817.79
5.4.160.0132.40517.63
5.4.150.0202.46717.92
5.4.140.0202.42016.78
5.4.130.0102.41916.68
5.4.120.0172.40316.60
5.4.110.0102.39316.67
5.4.100.0102.47016.89
5.4.90.0102.47716.76
5.4.80.0122.44516.62
5.4.70.0072.47216.69
5.4.60.0092.47516.66
5.4.50.0152.47116.56
5.4.40.0102.46316.52
5.4.30.0152.43616.77
5.4.20.0122.46416.62
5.4.10.0182.45516.79
5.4.00.0172.41216.41
5.3.290.0020.02512.91
5.3.280.0030.03713.85
5.3.270.0120.03013.73
5.3.260.0130.02213.93
5.3.250.0050.04213.82
5.3.240.0030.03213.77
5.3.230.0070.02713.81
5.3.220.0050.03113.81
5.3.210.0120.02313.79
5.3.200.0050.02913.89
5.3.190.0080.02513.88
5.3.180.0090.03013.91
5.3.170.0100.03713.78
5.3.160.0080.03313.84
5.3.150.0100.02913.81
5.3.140.0030.04113.84
5.3.130.0050.03413.88
5.3.120.0070.04413.78
5.3.110.0090.02913.83
5.3.100.0020.03013.60
5.3.90.0080.02613.57
5.3.80.0050.03013.56
5.3.70.0070.03213.44
5.3.60.0070.03513.60
5.3.50.0040.03513.47
5.3.40.0070.02513.53
5.3.30.0050.02713.48
5.3.20.0030.02913.37
5.3.10.0070.02713.38
5.3.00.0050.02713.33
5.2.170.0100.05310.97
5.2.160.0070.05711.27
5.2.150.0000.04711.36
5.2.140.0000.05711.30
5.2.130.0100.05311.06
5.2.120.0070.04011.08
5.2.110.0100.03710.93
5.2.100.0070.04011.27
5.2.90.0030.04711.18
5.2.80.0130.03711.06
5.2.70.0000.04311.15
5.2.60.0070.04711.06
5.2.50.0070.05011.11
5.2.40.0130.03311.00
5.2.30.0000.05011.19
5.2.20.0030.05310.96
5.2.10.0030.05010.87
5.2.00.0000.04710.72
5.1.60.0030.03310.03
5.1.50.0000.04010.01
5.1.40.0100.04010.07
5.1.30.0100.04310.33
5.1.20.0030.05310.41
5.1.10.0070.0479.91
5.1.00.0070.04010.30
5.0.50.0070.0378.78
5.0.40.0100.0238.57
5.0.30.0000.0478.41
5.0.20.0070.0308.17
5.0.10.0000.0308.27
5.0.00.0070.0408.22
4.4.90.0000.0277.41
4.4.80.0070.0277.41
4.4.70.0070.0177.41
4.4.60.0100.0177.41
4.4.50.0170.0177.41
4.4.40.0030.0377.41
4.4.30.0030.0237.41
4.4.20.0030.0237.41
4.4.10.0030.0307.41
4.4.00.0030.0307.41
4.3.110.0030.0277.41
4.3.100.0030.0237.41
4.3.90.0030.0207.41
4.3.80.0000.0377.41
4.3.70.0030.0277.41
4.3.60.0100.0137.41
4.3.50.0070.0277.41
4.3.40.0000.0407.41
4.3.30.0070.0207.41
4.3.20.0030.0207.41
4.3.10.0000.0277.41
4.3.00.0170.0207.02

preferences:
38.71 ms | 401 KiB | 5 Q