3v4l.org

run code in 300+ PHP versions simultaneously
<?php function event($name,$cb = null){ static $e = array(); if ( is_callable($cb) ){ empty( $e[$name] ) ? $e[$name] = array($cb) : $e[$name][] = $cb; } elseif ( false === empty($e[$name]) ) { $a = is_array($cb) ? $cb : array(); foreach ($e[$name] as $eh) call_user_func_array($eh,$a); } } // Add a foo event handler event('foo',function(){ print_r(func_get_args()); }); // Add another foo event handler event('foo',function(){ echo 'Hello, friend!'; }); // Call foo event with parameters event('foo',[1,2]); // Call bar event (does nothing) event('bar');

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.0090.00618.68
8.3.50.0100.00722.05
8.3.40.0080.00818.84
8.3.30.0120.00819.08
8.3.20.0000.00820.32
8.3.10.0030.00622.09
8.3.00.0050.00322.37
8.2.180.0130.00816.35
8.2.170.0060.00822.96
8.2.160.0090.00921.04
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0050.00317.75
8.2.110.0040.01820.94
8.2.100.0120.00017.84
8.2.90.0050.00317.75
8.2.80.0000.00920.54
8.2.70.0050.00318.05
8.2.60.0000.00717.93
8.2.50.0030.00618.10
8.2.40.0030.00520.60
8.2.30.0040.00418.19
8.2.20.0040.00417.75
8.2.10.0070.00019.54
8.2.00.0030.00617.65
8.1.280.0110.00725.92
8.1.270.0040.00423.84
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0110.00021.03
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0050.00318.72
8.1.160.0000.00721.95
8.1.150.0030.00518.70
8.1.140.0030.00617.52
8.1.130.0000.00717.85
8.1.120.0000.00717.47
8.1.110.0040.00417.49
8.1.100.0000.00817.37
8.1.90.0040.00417.45
8.1.80.0040.00417.38
8.1.70.0040.00417.46
8.1.60.0040.00417.52
8.1.50.0040.00417.59
8.1.40.0000.00817.43
8.1.30.0070.00317.60
8.1.20.0040.00417.59
8.1.10.0000.00817.62
8.1.00.0040.00417.56
8.0.300.0070.00020.05
8.0.290.0040.00716.63
8.0.280.0030.00318.42
8.0.270.0040.00416.76
8.0.260.0030.00316.89
8.0.250.0000.00717.01
8.0.240.0030.00516.84
8.0.230.0000.00816.86
8.0.220.0040.00416.93
8.0.210.0030.00316.94
8.0.200.0030.00316.95
8.0.190.0030.00416.83
8.0.180.0070.00016.96
8.0.170.0000.00716.84
8.0.160.0040.00416.98
8.0.150.0040.00416.74
8.0.140.0040.00416.88
8.0.130.0000.00613.30
8.0.120.0040.00416.87
8.0.110.0000.00816.81
8.0.100.0040.00416.97
8.0.90.0040.00416.86
8.0.80.0110.00516.93
8.0.70.0030.00316.77
8.0.60.0030.00516.93
8.0.50.0050.00216.97
8.0.30.0140.00917.09
8.0.20.0110.00717.40
8.0.10.0040.00416.84
8.0.00.0100.00816.75
7.4.330.0000.00615.07
7.4.320.0000.00616.50
7.4.300.0000.00716.62
7.4.290.0030.00316.62
7.4.280.0040.00416.51
7.4.270.0000.00716.52
7.4.260.0070.00016.52
7.4.250.0040.00416.41
7.4.240.0040.00416.55
7.4.230.0000.00716.43
7.4.220.0090.00916.64
7.4.210.0070.00716.61
7.4.200.0000.00716.32
7.4.190.0050.00216.58
7.4.160.0120.00316.45
7.4.150.0100.00717.40
7.4.140.0140.00817.86
7.4.130.0030.01716.55
7.4.120.0100.00616.49
7.4.110.0090.00616.50
7.4.100.0000.01916.43
7.4.90.0140.00316.39
7.4.80.0060.01219.39
7.4.70.0100.00616.41
7.4.60.0130.00316.53
7.4.50.0060.00316.26
7.4.40.0040.01522.77
7.4.30.0130.00916.74
7.4.00.0000.01714.65
7.3.330.0030.00313.38
7.3.320.0020.00213.09
7.3.310.0030.00316.43
7.3.300.0040.00416.41
7.3.290.0110.00716.37
7.3.280.0060.00816.33
7.3.270.0140.00417.40
7.3.260.0140.00316.34
7.3.250.0060.01016.39
7.3.240.0060.01116.23
7.3.230.0070.01016.56
7.3.210.0070.01016.61
7.3.200.0160.00619.39
7.3.190.0070.01016.39
7.3.180.0030.01716.58
7.3.170.0150.00616.69
7.3.160.0170.00416.40
7.3.120.0100.00314.86
7.3.10.0120.00016.57
7.3.00.0030.01016.47
7.2.330.0130.00316.43
7.2.320.0150.00416.67
7.2.310.0000.01716.75
7.2.300.0090.00916.61
7.2.290.0080.00916.54
7.2.130.0100.00616.99
7.2.120.0030.01016.98
7.2.110.0060.00616.92
7.2.100.0080.00816.76
7.2.90.0130.00316.86
7.2.80.0080.00416.73
7.2.70.0030.00716.94
7.2.60.0110.00316.97
7.2.50.0040.00717.00
7.2.40.0030.01017.06
7.2.30.0000.01517.00
7.2.20.0030.01016.88
7.2.10.0070.00716.55
7.2.00.0030.00918.19
7.1.250.0000.01415.87
7.1.200.0040.00415.56
7.1.100.0040.00418.02
7.1.70.0080.00416.61
7.1.60.0100.01419.82
7.1.50.0210.01034.89
7.1.00.0100.06722.48
7.0.200.0030.00316.84
7.0.140.0000.07022.08
7.0.60.0030.04320.03
7.0.50.0070.07717.86
7.0.40.0170.07320.14
7.0.30.0130.05020.23
7.0.20.0330.07320.09
7.0.10.0170.08320.10
7.0.00.0070.06720.18
5.6.280.0070.07020.82
5.6.210.0200.06320.51
5.6.200.0030.07718.18
5.6.190.0070.04320.55
5.6.180.0400.06320.68
5.6.170.0230.07720.47
5.6.160.0130.06320.46
5.6.150.0030.08318.19
5.6.140.0130.04318.24
5.6.130.0030.04318.21
5.6.120.0000.07721.03
5.6.110.0100.06721.00
5.6.100.0100.07320.99
5.6.90.0100.04721.01
5.6.80.0170.07020.36
5.5.350.0100.07720.44
5.5.340.0030.07018.02
5.5.330.0200.07320.40
5.5.320.3930.04720.37
5.5.310.0270.07720.28
5.5.300.0070.08018.03
5.5.290.0100.05718.00
5.5.280.0070.08320.88
5.5.270.0070.05320.78
5.5.260.0070.04720.80
5.5.250.0170.04720.80
5.5.240.0100.07320.12
5.4.450.1800.03319.55
5.4.440.2070.04019.49
5.4.430.1730.04019.19
5.4.420.1930.04019.46
5.4.410.0070.04319.28
5.4.400.0030.03718.84
5.4.390.1770.04319.14
5.4.380.2070.03318.99
5.4.370.1830.03319.16
5.4.360.1770.04019.03
5.4.350.2030.04719.09
5.4.340.2000.04319.14
5.4.320.2030.04019.16
5.4.310.1900.04719.17
5.4.300.1800.03319.05
5.4.290.2070.04019.21
5.4.280.2030.04319.08
5.4.270.2100.04019.06
5.4.260.2100.05318.99
5.4.250.2030.04019.16
5.4.240.2230.03719.08
5.4.230.2000.05019.16
5.4.220.1900.04018.97
5.4.210.2170.04019.23
5.4.200.2070.04019.08
5.4.190.2030.03718.98
5.4.180.2000.04019.15
5.4.170.2000.04019.21
5.4.160.2000.04319.04
5.4.150.1970.04319.15
5.4.140.1930.04316.39
5.4.130.1830.03316.43
5.4.120.2100.03716.44
5.4.110.2070.03716.50
5.4.100.2170.04016.60
5.4.90.1870.04016.50
5.4.80.1800.03316.29
5.4.70.1930.03016.57
5.4.60.2030.04016.43
5.4.50.2070.04316.52
5.4.40.1770.03716.33
5.4.30.1800.03316.32
5.4.20.1830.03016.24
5.4.10.1900.04316.32
5.4.00.1830.03716.11
5.3.290.1700.04314.58
5.3.280.1730.03714.61
5.3.270.1900.04314.52
5.3.260.1700.04014.63
5.3.250.1830.04714.61
5.3.240.1770.03714.73
5.3.230.1700.04014.69
5.3.220.1970.04714.72
5.3.210.2030.05014.55
5.3.200.1830.04014.80
5.3.190.2100.03314.58
5.3.180.1900.04014.54
5.3.170.2230.03714.62
5.3.160.1970.04714.58
5.3.150.2030.04314.57
5.3.140.2000.04314.62
5.3.130.0400.06714.52
5.3.120.0070.07014.54
5.3.110.0030.04314.80
5.3.100.0130.06714.03
5.3.90.2100.04014.14
5.3.80.2130.03714.08
5.3.70.1800.04714.01
5.3.60.2030.04314.25
5.3.50.2030.03314.01
5.3.40.2100.03314.04
5.3.30.1830.03013.92
5.3.20.1700.03713.60
5.3.10.1970.04013.59
5.3.00.1700.03713.76
5.2.170.1700.03011.05
5.2.160.1530.03711.06
5.2.150.1670.03711.13
5.2.140.1770.04011.06
5.2.130.1430.02711.01
5.2.120.1670.03711.27
5.2.110.1500.02711.01
5.2.100.1700.03711.01
5.2.90.1770.03711.04
5.2.80.1670.03711.00
5.2.70.1770.02711.02
5.2.60.1500.02711.12
5.2.50.1430.03011.23
5.2.40.1470.03011.00
5.2.30.1430.03711.05
5.2.20.1330.04010.86
5.2.10.1170.02710.83
5.2.00.1330.03010.77
5.1.60.1270.03010.22
5.1.50.1200.0279.92
5.1.40.1270.0309.96
5.1.30.1300.02710.43
5.1.20.1370.03710.32
5.1.10.1500.0339.99
5.1.00.1370.03010.05
5.0.50.0800.0278.61
5.0.40.0730.0278.41
5.0.30.0700.0408.29
5.0.20.0030.0308.29
5.0.10.0070.0408.11
5.0.00.0070.0238.07
4.4.90.0030.0307.65
4.4.80.0000.0177.65
4.4.70.0000.0277.65
4.4.60.0030.0377.65
4.4.50.0000.0177.65
4.4.40.0530.0377.65
4.4.30.0630.0177.65
4.4.20.0800.0237.65
4.4.10.0870.0237.65
4.4.00.0630.0237.65
4.3.110.0330.0137.65
4.3.100.0000.0207.65
4.3.90.0000.0137.65
4.3.80.0000.0277.65
4.3.70.0000.0177.65
4.3.60.0030.0137.65
4.3.50.0000.0177.65
4.3.40.0000.0237.65
4.3.30.0000.0177.65
4.3.20.0000.0207.65
4.3.10.0000.0177.65
4.3.00.0000.0307.65

preferences:
37.3 ms | 401 KiB | 5 Q