3v4l.org

run code in 300+ PHP versions simultaneously
<?php $closure1 = function($val){ return $val; }; $closure2 = function($val){ return $val; }; $reflection_class = new ReflectionClass($closure1); $reflection_method = $reflection_class->getMethod('__invoke'); $arguments1 = array('hello'); $arguments2 = array('world'); // Invoking once is OK... print $reflection_method->invokeArgs($closure1, $arguments1); if(true){ // But don't do it again! #print $reflection_method->invokeArgs($closure1, $arguments1); // Using different arguments per invokation makes no difference :( #print $reflection_method->invokeArgs($closure1, $arguments2); // Doesn't matter if you attempt to invoke a different closure with the same reflection. print $reflection_method->invokeArgs($closure2, $arguments1);

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)
5.4.310.0470.07019.06
5.4.300.0400.06319.16
5.4.290.0400.04019.24
5.4.280.0470.03719.08
5.4.270.0470.06718.98
5.4.260.0470.04319.06
5.4.250.0330.05719.24
5.4.240.0570.05719.21
5.4.230.0430.06019.24
5.4.220.0470.07319.13
5.4.210.0370.04019.23
5.4.200.0470.04718.85
5.4.190.0530.05719.15
5.4.180.0400.05019.21
5.4.170.0400.04719.25
5.4.160.0500.05318.95
5.4.150.0400.04019.13
5.4.140.0470.06316.37
5.4.130.0370.03716.56
5.4.120.0370.05716.71
5.4.110.0500.05716.48
5.4.100.0330.04316.52
5.4.90.0430.02716.43
5.4.80.0330.03716.44
5.4.70.0230.04016.60
5.4.60.0370.03016.52
5.4.50.0330.03016.54
5.4.40.0230.05016.38
5.4.30.0270.03716.55
5.4.20.0330.03316.32
5.4.10.0270.03716.51
5.4.00.0470.03315.96
5.3.290.0530.06014.72
5.3.280.0430.03314.62
5.3.270.0500.06714.54
5.3.260.0330.04714.69
5.3.250.0300.04314.55
5.3.240.0400.03714.83
5.3.230.0430.05014.61
5.3.220.0400.03714.62
5.3.210.0270.04714.55
5.3.200.0470.05314.57
5.3.190.0400.03714.66
5.3.180.0330.03714.48
5.3.170.0300.03714.57
5.3.160.0370.03014.73
5.3.150.0400.02714.46
5.3.140.0330.03014.55
5.3.130.0300.03714.57
5.3.120.0330.03314.71
5.3.110.0330.03314.47
5.3.100.0330.03314.26
5.3.90.0270.03713.94
5.3.80.0270.04314.10
5.3.70.0300.03713.93
5.3.60.0300.03714.03
5.3.50.0400.02313.97
5.3.40.0330.04013.88
5.3.30.0270.03713.93
5.3.20.0230.04013.61
5.3.10.0270.03713.88
5.3.00.0300.03313.56
5.2.170.0270.02711.72
5.2.160.0230.03011.72
5.2.150.0270.02711.72
5.2.140.0300.02711.72
5.2.130.0300.02711.72
5.2.120.0370.02711.72
5.2.110.0270.02711.72
5.2.100.0270.02311.72
5.2.90.0270.03011.72
5.2.80.0230.02711.72
5.2.70.0270.02711.72
5.2.60.0200.03311.72
5.2.50.0230.03011.72
5.2.40.0130.03311.72
5.2.30.0170.03011.72
5.2.20.0200.03711.72
5.2.10.0170.03011.72
5.2.00.0230.02311.72
5.1.60.0200.02311.72
5.1.50.0270.04711.72
5.1.40.0400.02311.72
5.1.30.0270.05311.72
5.1.20.0230.03711.72
5.1.10.0230.02711.72
5.1.00.0270.03711.72
5.0.50.0170.01711.72
5.0.40.0170.03711.72
5.0.30.0100.06011.72
5.0.20.0130.01711.72
5.0.10.0230.02011.72
5.0.00.0130.06711.72
4.4.90.0070.02011.72
4.4.80.0100.01311.72
4.4.70.0100.01311.72
4.4.60.0130.01711.72
4.4.50.0130.01011.72
4.4.40.0130.02011.72
4.4.30.0130.03711.72
4.4.20.0100.02011.72
4.4.10.0170.02311.72
4.4.00.0130.04711.72
4.3.110.0130.02311.72
4.3.100.0130.03011.72
4.3.90.0200.02011.72
4.3.80.0100.04011.72
4.3.70.0230.02311.72
4.3.60.0230.01311.72
4.3.50.0230.01711.72
4.3.40.0170.02711.72
4.3.30.0070.03711.72
4.3.20.0100.01711.72
4.3.10.0130.01311.72
4.3.00.0100.03311.72

preferences:
139.84 ms | 1386 KiB | 7 Q