3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { /* function foo() { echo __METHOD__.PHP_EOL; } */ } $object = new x(); $method = 'foo'; $callable = [$object, $method]; //$callable(1); // Call to undefined method stdClass::foo() // No check until execution $closure = fn (...$args) => $object->$method(...$args); //$closure(1); // Call to undefined method stdClass::foo() //Call to undefined method stdClass::foo() $closure = [$object, $method](...); //Failed to create closure from callable: class stdClass does not have a method "foo" Closure::fromCallable([$object, $method]);

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.5.70.0100.00816.98
8.5.60.0140.00716.78
8.5.50.0130.00416.91
8.5.30.0100.00818.12
8.5.20.0090.00720.16
8.5.10.0090.01017.08
8.5.00.0130.00922.96
8.4.220.0130.01019.56
8.4.210.0090.01219.61
8.4.180.0110.01120.65
8.4.170.0110.01223.66
8.4.160.0130.00923.60
8.4.150.0060.00716.89
8.4.140.0110.00917.58
8.4.130.0130.00817.97
8.4.120.0420.00818.02
8.4.110.0220.00718.20
8.4.100.0270.00917.93
8.4.90.0410.00818.29
8.4.80.0280.00118.19
8.4.70.0160.00617.84
8.4.60.0280.00817.74
8.4.50.0140.00917.81
8.4.40.0250.00817.75
8.4.30.0390.01017.89
8.4.20.0550.00617.64
8.4.10.0350.01117.64
8.3.300.0120.01018.50
8.3.290.0140.00820.25
8.3.280.0060.00616.27
8.3.270.0100.00916.74
8.3.260.0120.00816.69
8.3.250.0400.00616.58
8.3.240.0350.00716.79
8.3.230.0180.00316.49
8.3.220.0170.00416.62
8.3.210.0190.00316.69
8.3.200.0160.00616.49
8.3.190.0240.00416.48
8.3.180.0240.00316.50
8.3.170.0170.00616.70
8.3.160.0360.01116.49
8.3.150.0440.00716.57
8.3.140.0360.01316.63
8.3.130.0350.01016.67
8.3.120.0350.01016.55
8.3.110.0370.00516.41
8.3.100.0440.00516.40
8.3.90.0430.00916.66
8.3.80.0400.00916.76
8.3.70.0410.01016.66
8.3.60.0430.00716.48
8.3.50.0410.00816.52
8.3.40.0420.00717.54
8.3.30.0380.00717.50
8.3.20.0440.00817.29
8.3.10.0380.00617.63
8.3.00.0400.00417.40
8.2.300.0130.01018.27
8.2.290.0330.01116.67
8.2.280.0330.00516.73
8.2.270.0310.00916.75
8.2.260.0340.00916.45
8.2.250.0340.00616.68
8.2.240.0370.01016.74
8.2.230.0270.00816.53
8.2.220.0210.00716.75
8.2.210.0260.00216.58
8.2.200.0180.00116.49
8.2.190.0300.00716.47
8.2.180.0340.00816.46
8.2.170.0370.00517.93
8.2.160.0350.00817.84
8.2.150.0360.00917.86
8.2.140.0360.00417.75
8.2.130.0350.00917.50
8.2.120.0320.00917.57
8.2.110.0390.00417.22
8.2.100.0320.01117.74
8.2.90.0340.00917.72
8.2.80.0250.00617.68
8.2.70.0350.00517.56
8.2.60.0320.01017.49
8.2.50.0380.00217.50
8.2.40.0310.00817.75
8.2.30.0430.00517.49
8.2.20.0350.00817.46
8.2.10.0220.00717.60
8.2.00.0160.00317.73
8.1.340.0130.00820.00

preferences:
54.92 ms | 867 KiB | 5 Q