3v4l.org

run code in 300+ PHP versions simultaneously
<?php // A simple test object class testObj { private $id; static private $sid; public function controller(array $array) { $this->id=$array; } public function setId($newId) { $this->id = $newId; } public function staticcontroller(array $array) { self::$sid=$array; } } class testFacade { function driver() { return "testObj"; } public static function __callStatic($method, $parameters) { return call_user_func_array(array(static::driver(), $method), $parameters); } } $params=array("a"=>1,"b"=>2,"c"=>3,"p"=>$_GET["m"]); $method=$_GET["m"]; for($i=0;$i<10;$i++) switch ($method) { case "variable": $a = "testObj"; $method = "setId"; $test1 = new $a; $test1->$method($_GET["m"]); $method = "controller"; $test1->$method($params); break; case "reflexion": $a = "testObj"; $method = "setId"; $reflectionClass = new ReflectionClass($a); $test2 = $reflectionClass->newInstance(); $reflectionMethod = $reflectionClass->getMethod($method); $reflectionMethod->invoke($test2,33); $method = "controller"; $reflectionMethod = $reflectionClass->getMethod($method); $reflectionMethod->invoke($test2,$params); break; case "call_user_func_array": $a = "testObj"; $test1 = new $a; $method = "setId"; $r=call_user_func_array(array($test1, $method), array(1)); $method = "controller"; $r=call_user_func_array(array($test1, $method), array( $params)); break; case "static1": testObj::staticcontroller($params); break; case "static2": $a = "testObj"; $method = "staticcontroller"; $a::$method($params); break; case "static3": testFacade::staticcontroller( $params); break; }

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.0130.00316.75
8.3.50.0220.00823.05
8.3.40.0110.00718.88
8.3.30.0090.00619.22
8.3.20.0000.00720.33
8.3.10.0080.00021.80
8.3.00.0090.00019.26
8.2.180.0150.00016.63
8.2.170.0100.00722.96
8.2.160.0100.01020.35
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0080.00019.95
8.2.110.0030.00721.09
8.2.100.0080.00418.09
8.2.90.0050.00319.20
8.2.80.0030.00517.97
8.2.70.0060.00317.49
8.2.60.0060.00318.03
8.2.50.0080.00018.07
8.2.40.0000.00818.22
8.2.30.0000.00718.22
8.2.20.0000.00817.85
8.2.10.0000.00818.15
8.2.00.0000.00817.76
8.1.280.0110.00625.92
8.1.270.0040.00423.73
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0070.00321.43
8.1.230.0080.00419.54
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0000.00917.22
8.1.190.0040.00417.25
8.1.180.0000.00818.10
8.1.170.0000.00918.57
8.1.160.0050.00322.15
8.1.150.0040.00418.79
8.1.140.0000.00817.57
8.1.130.0030.00317.91
8.1.120.0070.00017.44
8.1.110.0080.00017.46
8.1.100.0040.00417.51
8.1.90.0070.00017.49
8.1.80.0040.00417.42
8.1.70.0030.00317.45
8.1.60.0040.00417.63
8.1.50.0000.00817.48
8.1.40.0080.00017.59
8.1.30.0040.00417.58
8.1.20.0000.00817.70
8.1.10.0000.00717.63
8.1.00.0070.00017.55
8.0.300.0050.00218.77
8.0.290.0040.00416.73
8.0.280.0000.00818.35
8.0.270.0050.00217.29
8.0.260.0000.00617.34
8.0.250.0040.00416.94
8.0.240.0000.00817.03
8.0.230.0030.00317.05
8.0.220.0030.00316.99
8.0.210.0030.00316.88
8.0.200.0060.00017.00
8.0.190.0040.00417.03
8.0.180.0000.00716.98
8.0.170.0040.00417.01
8.0.160.0040.00417.00
8.0.150.0000.00716.97
8.0.140.0050.00516.86
8.0.130.0000.00613.45
8.0.120.0080.00016.96
8.0.110.0050.00216.93
8.0.100.0040.00417.02
8.0.90.0000.00716.96
8.0.80.0110.00417.04
8.0.70.0030.00517.06
8.0.60.0040.00416.99
8.0.50.0000.00817.04
8.0.30.0080.01417.29
8.0.20.0080.01217.40
8.0.10.0000.00716.97
8.0.00.0100.01016.67
7.4.330.0070.00015.00
7.4.320.0030.00316.50
7.4.300.0050.00216.64
7.4.290.0060.00316.51
7.4.280.0070.00016.45
7.4.270.0050.00216.57
7.4.260.0030.00616.62
7.4.250.0030.00516.50
7.4.240.0040.00416.65
7.4.230.0070.00016.44
7.4.220.0090.01016.55
7.4.210.0070.01016.56
7.4.200.0070.00016.44
7.4.160.0080.00816.61
7.4.150.0210.00317.40
7.4.140.0070.01217.86
7.4.130.0120.00616.53
7.4.120.0060.01116.74
7.4.110.0070.01016.76
7.4.100.0060.01016.48
7.4.90.0090.00916.52
7.4.80.0120.00619.39
7.4.70.0130.00616.61
7.4.60.0070.01316.77
7.4.50.0000.00416.39
7.4.40.0120.00416.61
7.4.30.0110.00616.53
7.4.10.0090.00914.97
7.4.00.0070.01114.85
7.3.330.0000.00613.47
7.3.320.0030.00313.54
7.3.310.0070.00016.49
7.3.300.0040.00416.38
7.3.290.0070.00716.45
7.3.280.0100.00816.49
7.3.270.0060.01217.40
7.3.260.0070.01016.55
7.3.250.0080.01116.63
7.3.240.0060.01016.52
7.3.230.0100.00716.66
7.3.210.0090.00916.39
7.3.200.0120.01119.39
7.3.190.0070.01416.58
7.3.180.0040.01216.57
7.3.170.0060.01016.57
7.3.160.0000.01716.56
7.3.130.0100.01014.79
7.3.120.0100.00714.83
7.3.110.0070.01314.76
7.3.100.0120.00314.86
7.3.90.0060.00914.77
7.3.80.0030.00715.00
7.3.70.0000.01714.65
7.3.60.0070.00714.93
7.3.50.0060.00614.52
7.3.40.0090.00014.89
7.3.30.0050.00814.71
7.3.20.0060.00616.45
7.3.10.0090.00616.85
7.3.00.0040.01116.70
7.2.330.0130.01016.61
7.2.320.0150.00616.72
7.2.310.0060.01216.55
7.2.300.0060.01016.64
7.2.290.0060.01216.64
7.2.260.0090.00914.89
7.2.250.0070.01114.72
7.2.240.0040.01114.85
7.2.230.0040.01114.76
7.2.220.0000.01214.98
7.2.210.0030.00915.17
7.2.200.0100.00615.25
7.2.190.0040.00414.81
7.2.180.0070.00715.14
7.2.170.0030.01015.13
7.2.160.0060.00314.78
7.2.150.0030.01016.99
7.2.140.0100.00716.79
7.2.130.0110.00416.48
7.2.120.0030.01016.98
7.2.110.0110.00416.75
7.2.100.0000.01716.84
7.2.90.0060.00617.05
7.2.80.0000.01417.07
7.2.70.0080.00616.96
7.2.60.0070.00716.86
7.2.50.0110.00316.77
7.2.40.0060.02017.07
7.2.30.0000.01616.50
7.2.20.0030.00916.80
7.2.10.0070.00717.08
7.2.00.0050.00718.17
7.1.330.0110.00415.82
7.1.320.0080.00515.41
7.1.310.0080.00815.52
7.1.300.0040.00415.78
7.1.290.0100.00315.80
7.1.280.0060.00915.71
7.1.270.0080.00315.61
7.1.260.0000.01615.99
7.1.250.0030.00615.95
7.1.240.0110.00315.86
7.1.230.0030.01015.80
7.1.220.0060.00615.82
7.1.210.0090.00315.46
7.1.200.0060.00715.67
7.1.190.0040.01115.80
7.1.180.0070.00715.48
7.1.170.0070.00715.50
7.1.160.0060.01215.69
7.1.150.0070.01015.78
7.1.140.0080.00415.75
7.1.130.0030.01015.46
7.1.120.0060.00615.51
7.1.110.0040.01115.86
7.1.100.0020.01016.90
7.1.90.0000.01415.92
7.1.80.0110.00415.90
7.1.70.0040.00716.57
7.1.60.0070.00917.56
7.1.50.0070.00616.34
7.1.40.0070.01015.69
7.1.30.0040.00715.83
7.1.20.0090.00315.68
7.1.10.0000.01015.54
7.1.00.0040.04119.05
7.0.330.0040.00715.57
7.0.320.0070.00715.32
7.0.310.0060.00615.27
7.0.300.0030.01015.53
7.0.290.0040.01115.34
7.0.280.0030.01415.59
7.0.270.0080.00415.22
7.0.260.0040.00715.36
7.0.250.0070.00315.35
7.0.240.0040.01115.35
7.0.230.0000.01215.34
7.0.220.0080.00015.67
7.0.210.0030.01315.34
7.0.200.0030.01116.06
7.0.190.0110.00415.15
7.0.180.0030.01015.23
7.0.170.0030.00615.37
7.0.160.0090.00615.23
7.0.150.0070.01015.48
7.0.140.0100.03718.75
7.0.130.0090.00015.50
7.0.120.0030.01215.30
7.0.110.0000.01315.43
7.0.100.0030.01015.38
7.0.90.0030.00815.42
7.0.80.0090.00615.42
7.0.70.0100.00315.50
7.0.60.0100.03817.65
7.0.50.0030.02916.54
7.0.40.0070.04516.69
7.0.30.0080.02516.87
7.0.20.0150.03516.90
7.0.10.0100.04416.79
7.0.00.0030.02516.64
5.6.400.0040.01114.13
5.6.390.0050.00514.68
5.6.380.0000.00914.38
5.6.370.0070.00314.66
5.6.360.0030.00914.54
5.6.350.0090.00614.77
5.6.340.0090.00014.65
5.6.330.0030.00814.18
5.6.320.0070.00714.56
5.6.310.0070.00714.71
5.6.300.0090.00614.32
5.6.290.0090.00614.18
5.6.280.0030.04217.84
5.6.270.0030.01114.57
5.6.260.0070.01114.57
5.6.250.0070.01014.55
5.6.240.0070.00714.56
5.6.230.0100.00614.51
5.6.220.0000.01014.14
5.6.210.0020.04617.45
5.6.200.0050.03516.23
5.6.190.0030.02617.53
5.6.180.0230.02517.43
5.6.170.0170.03317.42
5.6.160.0030.02517.44
5.6.150.0060.04616.24
5.6.140.0080.03116.21
5.6.130.0040.04516.18
5.6.120.0060.03617.62
5.6.110.0060.02317.70
5.6.100.0070.04417.77
5.6.90.0100.03517.82
5.6.80.0030.02517.38
5.6.70.0040.00714.22
5.6.60.0030.01014.16
5.6.50.0080.00014.20
5.6.40.0070.01014.23
5.6.30.0130.00314.37
5.6.20.0040.00914.18
5.6.10.0030.01014.13
5.6.00.0040.01214.26
5.5.380.0120.00014.63
5.5.370.0060.01014.32
5.5.360.0030.00914.31
5.5.350.0180.03917.33
5.5.340.0080.03216.20
5.5.330.0050.03317.43
5.5.320.0100.03917.31
5.5.310.0160.03017.32
5.5.300.0070.03816.19
5.5.290.0080.04316.13
5.5.280.0120.03717.53
5.5.270.0060.04817.61
5.5.260.0080.03517.61
5.5.250.0050.02517.42
5.5.240.0060.02317.14
5.5.230.0000.01014.42
5.5.220.0030.01014.26
5.5.210.0030.01014.26
5.5.200.0030.00814.43
5.5.190.0060.00614.41
5.5.180.0070.00714.32
5.5.170.0040.01114.29
5.5.160.0120.00414.41
5.5.150.0030.01014.50
5.5.140.0000.01214.31
5.5.130.0130.00014.03
5.5.120.0040.00414.33
5.5.110.0090.00614.50
5.5.100.0100.00314.43
5.5.90.0100.00314.06
5.5.80.0040.00814.40
5.5.70.0060.00614.13
5.5.60.0060.00314.20
5.5.50.0060.00314.21
5.5.40.0030.01014.15
5.5.30.0080.00014.03
5.5.20.0030.00614.18
5.5.10.0100.00714.40
5.5.00.0090.00614.07
5.4.450.0030.04215.09
5.4.440.0030.02515.26
5.4.430.0080.03915.38
5.4.420.0050.02715.22
5.4.410.0050.03115.14
5.4.400.0020.04315.12
5.4.390.0030.03714.98
5.4.380.0060.04114.96
5.4.370.0070.02615.07
5.4.360.0040.02514.97
5.4.350.0050.03015.09
5.4.340.0050.03814.96
5.4.330.0030.00311.03
5.4.320.0050.02514.88
5.4.310.0050.02915.23
5.4.300.0050.02214.75
5.4.290.0050.03615.08
5.4.280.0060.02815.06
5.4.270.0030.03115.07
5.4.260.0030.04115.07
5.4.250.0000.03214.99
5.4.240.0050.02814.86
5.4.230.0050.04115.19
5.4.220.0050.03615.00
5.4.210.0110.03415.13
5.4.200.0050.02214.86
5.4.190.0110.03115.20
5.4.180.0080.03315.24
5.4.170.0030.04515.07
5.4.160.0110.03115.14
5.4.150.0030.03215.08
5.4.140.0040.02213.63
5.4.130.0030.02013.62
5.4.120.0080.03813.83
5.4.110.0050.03913.74
5.4.100.0110.03113.82
5.4.90.0080.02513.92
5.4.80.0070.01813.82
5.4.70.0070.03513.65
5.4.60.0050.03013.81
5.4.50.0030.04313.70
5.4.40.0070.04213.83
5.4.30.0050.03013.69
5.4.20.0080.03013.64
5.4.10.0100.03813.50
5.4.00.0100.02813.56
5.3.290.0130.04314.61
5.3.280.0030.04314.54
5.3.270.0070.06314.69
5.3.260.0070.07714.77
5.3.250.0030.04314.70
5.3.240.0070.07014.67
5.3.230.0100.07314.64
5.3.220.0030.04314.73
5.3.210.0030.04014.61
5.3.200.0100.04714.73
5.3.190.0170.07014.62
5.3.180.0030.07014.64
5.3.170.0030.04014.61
5.3.160.0030.06314.65
5.3.150.0070.08014.47
5.3.140.0000.05314.73
5.3.130.0070.05314.71
5.3.120.0100.07314.49
5.3.110.0070.04314.72
5.3.100.0070.06014.07
5.3.90.0070.06714.04
5.3.80.0170.05314.19
5.3.70.0030.05314.11
5.3.60.0000.06014.02
5.3.50.0030.07714.00
5.3.40.0100.07013.99
5.3.30.0130.04314.09
5.3.20.0070.03713.66
5.3.10.0030.03713.82
5.3.00.0130.06313.66
5.2.170.0030.06311.31
5.2.160.0000.06011.31
5.2.150.0070.06311.21
5.2.140.0100.06011.19
5.2.130.0070.05311.00
5.2.120.0070.05011.13
5.2.110.0030.06011.16
5.2.100.0100.06011.12
5.2.90.0030.04711.07
5.2.80.0000.04011.11
5.2.70.0100.05711.25
5.2.60.0030.06311.13
5.2.50.0030.06011.03
5.2.40.0000.06011.06
5.2.30.0000.05010.97
5.2.20.0030.03311.02
5.2.10.0070.05710.79
5.2.00.0170.04710.77
5.1.60.0030.04010.07
5.1.50.0030.03710.00
5.1.40.0000.03310.04
5.1.30.0000.05710.39
5.1.20.0030.05710.44
5.1.10.0070.05010.23
5.1.00.0000.05310.10
5.0.50.0030.0238.45
5.0.40.0030.0208.32
5.0.30.0000.0608.19
5.0.20.0030.0278.35
5.0.10.0000.0338.23
5.0.00.0070.0678.20
4.4.90.0030.0277.69
4.4.80.0100.0237.69
4.4.70.0030.0177.69
4.4.60.0000.0177.69
4.4.50.0000.0177.69
4.4.40.0070.0437.69
4.4.30.0000.0207.69
4.4.20.0030.0307.69
4.4.10.0030.0277.69
4.4.00.0030.0407.69
4.3.110.0000.0337.69
4.3.100.0000.0237.69
4.3.90.0000.0337.69
4.3.80.0000.0377.69
4.3.70.0000.0177.69
4.3.60.0000.0177.69
4.3.50.0000.0177.69
4.3.40.0030.0507.69
4.3.30.0000.0177.69
4.3.20.0030.0137.69
4.3.10.0070.0207.69
4.3.00.0000.0307.69

preferences:
52.33 ms | 401 KiB | 5 Q