3v4l.org

run code in 300+ PHP versions simultaneously
<?php function e($n,$p,$c=0){static $a;@krsort($a[$n]);if($c)$a[$n][$p][]=$c;else foreach($a[$n] as$q)foreach($q as$r)$r($p);} function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} ob_start(); e( 'event', 0, function ($data) { echo "event, $data, priority 0;"; } ); e( 'event', 10, function ($data) { echo "event, $data, priority 10;"; } ); e( 'other_event', -5, function ($data) { echo "other_event, $data, priority -5;"; } ); e( 'other_event', 5, function ($data) { echo "other_event, $data priority 5;"; } ); e('event', 'dataX'); e('other_event', 'dataY'); $output = ob_get_contents(); ob_end_clean(); it( 'calls event listeners in the right order', $output === 'event, dataX, priority 10;event, dataX, priority 0;other_event, dataY priority 5;other_event, dataY, priority -5;' ); class Foo { private $eventDispatcher; function __construct($eventDispatcher) { $this->eventDispatcher = $eventDispatcher; } function doStuff() { // ... call_user_func($this->eventDispatcher, "my_event", "my data"); } } ob_start(); $foo = new Foo(@e); e("my_event", 5, function($data) { echo "My event was called with '$data'";}); $foo->doStuff(); $output = ob_get_contents();ob_end_clean(); it( 'is perfectly possible to inject the event dispatcher as a dependency into classes.', $output === "My event was called with 'my data'" );

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.0120.00318.43
8.3.60.0070.00718.55
8.3.50.0120.00921.27
8.3.40.0090.00618.72
8.3.30.0070.00719.30
8.3.20.0080.00020.21
8.3.10.0030.00620.48
8.3.00.0030.00619.25
8.2.180.0040.01116.88
8.2.170.0040.01122.96
8.2.160.0070.01020.52
8.2.150.0070.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0060.00322.03
8.2.110.0040.00721.18
8.2.100.0070.00417.97
8.2.90.0000.00918.41
8.2.80.0000.00917.97
8.2.70.0030.00617.75
8.2.60.0060.00317.93
8.2.50.0090.00418.07
8.2.40.0080.00018.16
8.2.30.0000.00719.43
8.2.20.0000.00817.76
8.2.10.0030.00518.20
8.2.00.0040.00417.89
8.1.280.0110.00325.92
8.1.270.0040.00423.82
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00319.40
8.1.230.0120.00021.02
8.1.220.0040.00417.79
8.1.210.0040.00418.92
8.1.200.0000.01517.24
8.1.190.0060.00317.25
8.1.180.0040.00418.10
8.1.170.0040.00418.61
8.1.160.0000.00722.09
8.1.150.0040.00418.87
8.1.140.0070.00017.53
8.1.130.0030.00317.78
8.1.120.0000.00817.54
8.1.110.0030.00617.52
8.1.100.0000.00817.37
8.1.90.0070.00017.61
8.1.80.0030.00617.54
8.1.70.0070.00017.44
8.1.60.0050.00517.57
8.1.50.0060.00317.43
8.1.40.0040.00417.50
8.1.30.0050.00317.73
8.1.20.0040.00417.77
8.1.10.0000.00717.62
8.1.00.0000.00817.58
8.0.300.0070.00320.16
8.0.290.0000.00716.88
8.0.280.0040.00418.43
8.0.270.0000.00717.07
8.0.260.0030.00318.53
8.0.250.0000.00717.03
8.0.240.0040.00416.98
8.0.230.0040.00417.06
8.0.220.0030.00317.11
8.0.210.0040.00417.02
8.0.200.0000.00617.04
8.0.190.0040.00416.98
8.0.180.0050.00317.11
8.0.170.0040.00416.98
8.0.160.0060.00316.84
8.0.150.0000.00716.88
8.0.140.0040.00416.96
8.0.130.0000.00513.50
8.0.120.0040.00417.02
8.0.110.0070.00017.00
8.0.100.0040.00416.97
8.0.90.0050.00216.88
8.0.80.0040.01817.07
8.0.70.0000.00716.92
8.0.60.0040.00417.06
8.0.50.0070.00016.89
8.0.30.0120.00917.15
8.0.20.0100.01017.40
8.0.10.0000.00917.10
8.0.00.0060.01216.86
7.4.330.0020.00215.08
7.4.320.0040.00416.43
7.4.300.0000.00616.49
7.4.290.0030.00316.57
7.4.280.0110.00016.71
7.4.270.0000.00616.65
7.4.260.0030.00316.65
7.4.250.0080.00016.65
7.4.240.0030.00416.67
7.4.230.0000.00716.70
7.4.220.0110.00716.75
7.4.210.0150.00416.67
7.4.200.0030.00316.74
7.4.160.0100.01316.67
7.4.150.0140.00817.40
7.4.140.0100.00817.86
7.4.130.0100.00816.56
7.4.120.0110.00616.66
7.4.110.0100.00716.62
7.4.100.0070.01116.71
7.4.90.0100.01416.68
7.4.80.0130.00616.69
7.4.70.0030.01316.54
7.4.60.0060.01116.54
7.4.50.0080.00016.63
7.4.40.0060.01016.70
7.4.30.0140.00316.79
7.4.10.0070.00716.55
7.4.00.0060.00815.80
7.3.330.0000.00613.32
7.3.320.0060.00013.45
7.3.310.0030.00316.44
7.3.300.0000.00716.43
7.3.290.0070.01316.53
7.3.280.0090.00816.45
7.3.270.0090.00917.40
7.3.260.0110.00816.45
7.3.250.0090.01116.59
7.3.240.0130.00716.48
7.3.230.0120.00616.42
7.3.210.0120.00616.57
7.3.200.0110.00719.39
7.3.190.0120.01216.73
7.3.180.0100.01016.65
7.3.170.0090.00916.54
7.3.160.0040.01216.68
7.3.130.0100.00716.51
7.3.120.0000.01516.47
7.3.110.0040.01216.45
7.3.100.0080.01116.41
7.3.90.0110.00816.35
7.3.80.0150.00716.44
7.3.70.0040.01316.27
7.3.60.0100.01016.34
7.3.50.0030.01716.44
7.3.40.0050.01416.36
7.3.30.0110.01116.37
7.3.20.0090.00918.23
7.3.10.0030.01517.34
7.3.00.0140.00617.41
7.2.330.0100.00716.60
7.2.320.0060.01316.70
7.2.310.0150.00916.82
7.2.300.0100.00716.73
7.2.290.0130.00516.71
7.2.260.0060.01216.80
7.2.250.0070.01316.58
7.2.240.0000.01716.43
7.2.230.0070.01116.78
7.2.220.0070.00716.75
7.2.210.0090.01316.62
7.2.200.0130.01016.59
7.2.190.0040.01516.49
7.2.180.0090.00916.64
7.2.170.0090.00916.64
7.2.160.0030.01716.73
7.2.150.0110.01118.51
7.2.140.0130.00918.39
7.2.130.0060.01217.49
7.2.120.0100.00917.66
7.2.110.0060.00917.45
7.2.100.0090.00917.71
7.2.90.0000.01517.72
7.2.80.0080.01117.60
7.2.70.0110.01017.71
7.2.60.0130.00717.50
7.2.50.0050.01317.52
7.2.40.0160.00617.67
7.2.30.0080.01017.66
7.2.20.0130.00717.45
7.2.10.0070.01117.61
7.2.00.0100.00518.33
7.1.330.0110.00817.58
7.1.320.0090.00917.35
7.1.310.0080.00417.41
7.1.300.0070.00717.24
7.1.290.0080.01217.43
7.1.280.0070.01417.49
7.1.270.0070.01217.22
7.1.260.0080.01117.49
7.1.250.0070.01216.43
7.1.240.0090.01317.52
7.1.230.0130.00917.28
7.1.220.0120.00917.24
7.1.210.0090.01517.30
7.1.200.0050.00916.59
7.1.190.0060.01117.34
7.1.180.0070.00717.18
7.1.170.0040.01517.30
7.1.160.0080.00817.38
7.1.150.0190.00317.29
7.1.140.0060.01017.34
7.1.130.0090.01317.32
7.1.120.0070.01017.21
7.1.110.0060.01817.32
7.1.100.0100.00917.55
7.1.90.0040.01517.11
7.1.80.0040.01517.43
7.1.70.0050.01017.11
7.1.60.0110.01218.32
7.1.50.0130.00917.05
7.1.40.0100.01017.32
7.1.30.0050.01817.38
7.1.20.0130.00717.48
7.1.10.0100.00717.22
7.1.00.0100.03819.86
7.0.330.0130.00716.91
7.0.320.0090.01217.17
7.0.310.0110.00717.14
7.0.300.0030.01316.93
7.0.290.0160.00817.11
7.0.280.0070.00816.99
7.0.270.0120.00816.97
7.0.260.0070.01416.90
7.0.250.0170.00617.11
7.0.240.0090.00717.00
7.0.230.0120.00917.03
7.0.220.0110.01117.05
7.0.210.0060.00917.05
7.0.200.0070.00616.97
7.0.190.0040.01417.07
7.0.180.0070.00717.00
7.0.170.0070.01117.11
7.0.160.0040.01317.01
7.0.150.0130.00517.14
7.0.140.0070.04119.52
7.0.130.0070.01017.03
7.0.120.0100.01016.92
7.0.110.0150.00717.04
7.0.100.0030.01917.05
7.0.90.0110.01117.09
7.0.80.0080.01617.10
7.0.70.2400.02518.40
7.0.60.0090.03118.50
7.0.50.0130.04117.53
7.0.40.0080.02517.54
7.0.30.0170.03517.61
7.0.20.0170.03517.53
7.0.10.0130.02517.52
7.0.00.0050.03217.62
5.6.400.0110.01115.85
5.6.390.0040.01815.84
5.6.380.0190.00316.38
5.6.370.0040.00816.07
5.6.360.0090.01116.03
5.6.350.0110.00716.05
5.6.340.0070.01315.96
5.6.330.0110.00816.00
5.6.320.0160.00516.08
5.6.310.0140.00715.71
5.6.300.0060.01615.83
5.6.290.0110.01115.79
5.6.280.0070.04118.41
5.6.270.0070.01315.88
5.6.260.0080.01515.78
5.6.250.0110.01415.86
5.6.240.0030.02016.14
5.6.230.0090.01215.98
5.6.220.0150.00916.05
5.6.210.0070.04918.27
5.6.200.0140.04217.18
5.6.190.0060.05318.39
5.6.180.0070.02518.26
5.6.170.0240.03618.20
5.6.160.0030.03318.23
5.6.150.0080.04517.08
5.6.140.0090.03217.08
5.6.130.0050.02517.08
5.6.120.0120.04718.41
5.6.110.0080.03218.44
5.6.100.0110.04518.58
5.6.90.0100.04518.53
5.6.80.0030.03018.15
5.6.70.0200.04218.15
5.6.60.0090.01315.79
5.6.50.0060.01515.79
5.6.40.0020.01915.77
5.6.30.0090.01216.21
5.6.20.0030.01715.91
5.6.10.0060.01315.85
5.6.00.0040.01415.88
5.5.380.0080.01616.14
5.5.370.0120.01616.14
5.5.360.0180.00516.20
5.5.350.0080.04718.33
5.5.340.0100.02916.95
5.5.330.0120.04418.10
5.5.320.0070.03818.13
5.5.310.0220.04018.20
5.5.300.0120.04517.09
5.5.290.0140.03016.92
5.5.280.0120.03118.38
5.5.270.0120.04018.38
5.5.260.0120.03418.37
5.5.250.0060.02918.24
5.5.240.0090.03417.98
5.5.230.0130.00715.89
5.5.220.0080.01715.92
5.5.210.0050.01915.97
5.5.200.0120.01415.72
5.5.190.0110.01015.71
5.5.180.0150.00815.89
5.5.170.0100.01615.92
5.5.160.0100.01616.01
5.5.150.0140.00615.90
5.5.140.0100.01316.00
5.5.130.0060.01915.89
5.5.120.0000.01915.79
5.5.110.0110.01315.90
5.5.100.0160.01015.79
5.5.90.0190.00616.02
5.5.80.0180.00716.04
5.5.70.0170.01015.95
5.5.60.0170.00715.77
5.5.50.0030.01815.84
5.5.40.0130.01315.89
5.5.30.0080.01516.08
5.5.20.0140.01215.72
5.5.10.0120.01215.96
5.5.00.0140.00815.83
5.4.450.0080.03316.23
5.4.440.0370.03716.06
5.4.430.0580.03016.15
5.4.420.0380.03115.88
5.4.410.0540.03115.94
5.4.400.0450.03415.90
5.4.390.0470.02816.06
5.4.380.0230.03415.58
5.4.370.0280.02715.66
5.4.360.0190.03115.75
5.4.350.0210.03415.79
5.4.340.0350.03515.65
5.4.330.0170.00312.84
5.4.320.0050.02612.61
5.4.310.0090.02212.75
5.4.300.0090.02412.66
5.4.290.0070.02512.79
5.4.280.0090.02012.55
5.4.270.0100.02012.63
5.4.260.0080.02412.66
5.4.250.0100.02112.54
5.4.240.0070.02212.60
5.4.230.0080.02412.63
5.4.220.0070.02312.57
5.4.210.0080.02312.68
5.4.200.0110.02112.67
5.4.190.0080.02212.67
5.4.180.0100.01912.55
5.4.170.0040.02412.50
5.4.160.0060.02412.63
5.4.150.0070.02212.54
5.4.140.0090.01912.39
5.4.130.0100.02312.40
5.4.120.0120.02012.51
5.4.110.0060.02412.43
5.4.100.0080.02412.42
5.4.90.0100.02212.32
5.4.80.0070.02412.39
5.4.70.0070.02212.38
5.4.60.0080.02312.37
5.4.50.0060.02412.31
5.4.40.0080.02012.42
5.4.30.0070.02312.41
5.4.20.0060.02312.44
5.4.10.0080.02512.46
5.4.00.0070.02612.05
5.3.290.0110.04012.80
5.3.280.0100.03712.71
5.3.270.0070.03912.73
5.3.260.0060.04512.73
5.3.250.0060.03712.73
5.3.240.0070.03712.73
5.3.230.0020.04212.72
5.3.220.0080.03612.69
5.3.210.0050.04112.69
5.3.200.0050.03812.68
5.3.190.0070.03812.69
5.3.180.0090.03412.69
5.3.170.0080.04112.69
5.3.160.0090.03712.69
5.3.150.0050.04112.69
5.3.140.0020.04312.67
5.3.130.0070.04812.67
5.3.120.0050.04012.67
5.3.110.0050.04012.67
5.3.100.0070.03612.15
5.3.90.0100.03312.14
5.3.80.0060.03612.13
5.3.70.0080.04312.13
5.3.60.0050.03812.12
5.3.50.0040.04512.06
5.3.40.0060.03612.06
5.3.30.0070.03512.02
5.3.20.0040.03711.81
5.3.10.0060.04211.77
5.3.00.0050.03811.75
5.2.170.0060.0349.23
5.2.160.0050.0379.24
5.2.150.0060.0309.24
5.2.140.0080.0329.24
5.2.130.0070.0279.20
5.2.120.0050.0289.19
5.2.110.0060.0279.19
5.2.100.0060.0309.19
5.2.90.0070.0299.18
5.2.80.0060.0299.19
5.2.70.0040.0379.19
5.2.60.0020.0329.14
5.2.50.0050.0319.11
5.2.40.0070.0269.09
5.2.30.0050.0379.06
5.2.20.0050.0299.05
5.2.10.0100.0278.95
5.2.00.0040.0298.82
5.1.60.0060.0228.11
5.1.50.0060.0248.10
5.1.40.0030.0258.07
5.1.30.0060.0248.43
5.1.20.0050.0328.45
5.1.10.0060.0268.18
5.1.00.0040.0318.18
5.0.50.0050.0246.65
5.0.40.0040.0256.52
5.0.30.0020.0336.32
5.0.20.0030.0206.29
5.0.10.0020.0216.27
5.0.00.0040.0306.27
4.4.90.0040.0144.78
4.4.80.0030.0164.75
4.4.70.0010.0174.76
4.4.60.0010.0194.76
4.4.50.0040.0144.77
4.4.40.0070.0274.70
4.4.30.0040.0164.76
4.4.20.0000.0224.84
4.4.10.0050.0144.85
4.4.00.0030.0264.76
4.3.110.0030.0164.67
4.3.100.0030.0154.66
4.3.90.0040.0134.64
4.3.80.0050.0234.58
4.3.70.0030.0144.63
4.3.60.0030.0204.63
4.3.50.0030.0154.63
4.3.40.0030.0244.54
4.3.30.0030.0153.31
4.3.20.0020.0163.29
4.3.10.0010.0163.25
4.3.00.0030.0206.86

preferences:
38.79 ms | 401 KiB | 5 Q