3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Hello2 { public function sayHello() { echo 'Hello '; } } class World2 { public function sayWorld() { echo 'World'; } } class MyHelloWorld2 { public $hello; public $world; public function __construct() { $this->hello = new Hello2(); $this->world = new World2(); } public function sayExclamationMark() { echo '!'; } public function __call($name, $arguments) { if (method_exists($this->hello, $name)) { var_dump('$this->hello->'.$name.'()'); // $this->hello->sayHello(); // 这个是可行的 // return $this->hello->sayHello(); // 这个就报错了 //return $this->hello->$name.'()'; return $this->hello->$name(); } if (method_exists($this->world, $name)) { // return $this->world->$name(); // 或者这样写 return call_user_func([$this->word, $name]); } if (!method_exists($this->hello, $name) && !method_exists($this->world, $name)) { echo '不存在此方法'; } } } $obj = new MyHelloWorld2(); $obj->sayHello(); $obj->sayWorld(); $obj->sayExclamationMark(); // 输出: // Hello World!

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.0070.01316.75
8.3.60.0160.00618.68
8.3.50.0120.00716.58
8.3.40.0000.01418.86
8.3.30.0090.00618.71
8.3.20.0040.00419.11
8.3.10.0000.00821.71
8.3.00.0090.00019.59
8.2.180.0110.00716.63
8.2.170.0070.00722.96
8.2.160.0110.00320.47
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00020.56
8.2.120.0000.00726.35
8.2.110.0140.00319.14
8.2.100.0110.00017.91
8.2.90.0040.00417.97
8.2.80.0040.00417.97
8.2.70.0060.00317.38
8.2.60.0030.00517.93
8.2.50.0060.00318.10
8.2.40.0040.00422.32
8.2.30.0030.00619.31
8.2.20.0000.00718.04
8.2.10.0070.00018.16
8.2.00.0000.00818.15
8.1.280.0120.00925.92
8.1.270.0000.00723.92
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0090.00019.13
8.1.230.0040.00820.97
8.1.220.0040.00417.76
8.1.210.0030.00518.96
8.1.200.0060.00317.50
8.1.190.0090.00017.25
8.1.180.0040.00418.10
8.1.170.0030.00518.30
8.1.160.0040.00419.12
8.1.150.0040.00418.85
8.1.140.0030.00619.55
8.1.130.0050.00218.92
8.1.120.0040.00417.41
8.1.110.0090.00017.41
8.1.100.0040.00417.52
8.1.90.0030.00717.39
8.1.80.0050.00217.40
8.1.70.0040.00417.53
8.1.60.0000.00917.62
8.1.50.0040.00417.47
8.1.40.0000.00817.61
8.1.30.0030.00517.61
8.1.20.0040.00417.57
8.1.10.0000.00817.70
8.1.00.0020.00517.43
8.0.300.0000.00720.11
8.0.290.0050.00216.75
8.0.280.0000.00718.54
8.0.270.0040.00417.18
8.0.260.0030.00316.93
8.0.250.0070.00017.08
8.0.240.0060.00317.08
8.0.230.0050.00216.96
8.0.220.0030.00316.85
8.0.210.0080.00016.95
8.0.200.0030.00317.09
8.0.190.0040.00417.07
8.0.180.0000.00717.01
8.0.170.0030.00317.01
8.0.160.0000.00816.98
8.0.150.0030.00516.95
8.0.140.0070.00016.98
8.0.130.0040.00413.41
8.0.120.0050.00316.87
8.0.110.0000.00716.79
8.0.100.0070.00017.07
8.0.90.0030.00517.03
8.0.80.0090.01216.99
8.0.70.0040.00416.80
8.0.60.0000.00717.08
8.0.50.0040.00417.06
8.0.30.0150.00317.19
8.0.20.0120.01617.42
8.0.10.0050.00317.24
8.0.00.0080.01117.05
7.4.330.0020.00215.55
7.4.320.0000.00716.46
7.4.300.0030.00316.57
7.4.290.0030.00316.49
7.4.280.0030.00516.67
7.4.270.0070.00016.64
7.4.260.0030.00316.61
7.4.250.0040.00416.41
7.4.240.0000.00716.50
7.4.230.0070.00016.57
7.4.220.0040.01216.52
7.4.210.0030.01216.65
7.4.200.0000.00716.39
7.4.160.0070.00916.64
7.4.150.0090.00917.40
7.4.140.0160.00917.86
7.4.130.0080.01216.39
7.4.120.0140.00816.54
7.4.110.0030.01416.46
7.4.100.0090.01516.68
7.4.90.0120.01216.54
7.4.80.0100.00719.39
7.4.70.0120.00616.58
7.4.60.0160.00316.55
7.4.50.0070.00716.52
7.4.40.0100.00616.59
7.4.30.0060.00916.49
7.4.10.0030.01716.26
7.4.00.0090.00715.36
7.3.330.0030.00313.47
7.3.320.0000.00513.41
7.3.310.0000.00716.45
7.3.300.0030.00316.38
7.3.290.0030.00316.27
7.3.280.0090.00716.41
7.3.270.0110.00717.40
7.3.260.0110.00716.47
7.3.250.0050.01216.55
7.3.240.0030.01416.50
7.3.230.0030.01316.38
7.3.210.0100.00716.52
7.3.200.0090.01016.51
7.3.190.0080.01016.57
7.3.180.0060.01216.62
7.3.170.0080.01116.41
7.3.160.0070.01016.39
7.3.130.0090.00616.31
7.3.120.0050.01115.78
7.3.110.0030.01315.65
7.3.100.0080.00815.76
7.3.90.0070.00915.64
7.3.80.0040.01315.59
7.3.70.0060.00815.66
7.3.60.0080.00615.60
7.3.50.0070.00515.67
7.3.40.0030.01015.61
7.3.30.0080.00815.62
7.3.20.0050.01117.34
7.3.10.0090.00617.18
7.3.00.0060.01017.14
7.2.330.0120.00616.76
7.2.320.0130.00316.36
7.2.310.0080.01616.88
7.2.300.0070.01116.43
7.2.290.0120.00616.49
7.2.260.0030.01816.73
7.2.250.0070.01415.96
7.2.240.0110.00715.80
7.2.230.0070.01215.71
7.2.220.0080.00815.92
7.2.210.0050.00915.84
7.2.200.0060.01015.74
7.2.190.0050.01015.81
7.2.180.0020.01315.54
7.2.170.0050.01215.87
7.2.160.0070.00316.52
7.2.150.0060.01218.43
7.2.140.0030.01218.45
7.2.130.0020.01117.56
7.2.120.0100.00817.60
7.2.110.0110.00817.52
7.2.100.0080.00717.45
7.2.90.0130.00417.47
7.2.80.0110.00717.57
7.2.70.0150.00517.51
7.2.60.0070.00917.39
7.2.50.0020.01517.61
7.2.40.0050.01117.74
7.2.30.0050.01017.56
7.2.20.0050.01017.73
7.2.10.0030.01117.40
7.2.00.0040.01118.17
7.1.330.0080.00616.52
7.1.320.0030.01016.67
7.1.310.0020.00916.41
7.1.300.0010.01016.48
7.1.290.0030.01216.68
7.1.280.0060.00916.58
7.1.270.0050.00716.54
7.1.260.0110.00416.54
7.1.250.0080.00916.46
7.1.240.0030.01217.30
7.1.230.0040.01117.24
7.1.220.0030.00717.33
7.1.210.0070.00717.32
7.1.200.0070.00816.47
7.1.190.0100.00317.17
7.1.180.0040.00817.33
7.1.170.0070.00717.29
7.1.160.0100.00317.30
7.1.150.0030.00917.27
7.1.140.0050.00517.32
7.1.130.0030.01017.28
7.1.120.0030.01217.46
7.1.110.0100.00017.45
7.1.100.0060.00617.49
7.1.90.0000.01217.33
7.1.80.0030.00717.27
7.1.70.0030.00917.26
7.1.60.0520.01325.19
7.1.50.0470.01725.17
7.1.40.0520.01125.07
7.1.30.0510.01425.13
7.1.20.0540.01025.10
7.1.10.0420.01115.93
7.1.00.0520.01016.04
7.0.330.0060.00617.04
7.0.320.0040.01116.96
7.0.310.0060.00317.04
7.0.300.0090.00616.86
7.0.290.0040.00716.89
7.0.280.0070.01317.01
7.0.270.0030.01216.95
7.0.260.0070.00317.02
7.0.250.0050.00517.14
7.0.240.0080.00617.22
7.0.230.0060.01317.03
7.0.220.0110.00417.00
7.0.210.0090.00317.01
7.0.200.0480.00616.07
7.0.190.0430.01115.86
7.0.180.0450.00915.75
7.0.170.0460.00615.82
7.0.160.0450.00715.69
7.0.150.0430.01415.84
7.0.140.0400.01415.78
7.0.130.0480.01015.81
7.0.120.0520.00715.86
7.0.110.0450.01115.70
7.0.100.0520.00915.74
7.0.90.0470.00915.78
7.0.80.0440.01015.90
7.0.70.0470.00815.65
7.0.60.0440.00915.82
7.0.50.0900.01015.71
7.0.40.0490.00914.84
7.0.30.0530.01214.84
7.0.20.0470.01014.77
7.0.10.0510.01014.61
7.0.00.0500.00914.68
5.6.400.0140.00415.99
5.6.390.0110.00715.68
5.6.380.0080.00816.00
5.6.370.0070.00715.78
5.6.360.0070.00716.01
5.6.350.0040.00715.91
5.6.340.0040.01115.73
5.6.330.0040.01215.89
5.6.320.0110.00516.18
5.6.310.0110.00415.95
5.6.300.0000.01015.86
5.6.290.0030.01215.88
5.6.280.0070.00715.90
5.6.270.0070.00715.87
5.6.260.0040.00816.03
5.6.250.0060.00916.14
5.6.240.0030.01015.80
5.6.230.0040.01115.92
5.6.220.0030.00915.79
5.6.210.0060.00615.76
5.6.200.0120.00315.79
5.6.190.0040.00816.20
5.6.180.0000.01616.05
5.6.170.0000.01315.79
5.6.160.0050.00816.12
5.6.150.0000.00915.71
5.6.140.0030.01315.70
5.6.130.0000.01815.98
5.6.120.0090.00616.14
5.6.110.0030.00915.91
5.6.100.0070.01015.93
5.6.90.0110.00615.85
5.6.80.0070.00715.54
5.6.70.0080.00815.75
5.6.60.0030.00715.77
5.6.50.0000.01515.79
5.6.40.0000.01615.86
5.6.30.0040.01115.72
5.6.20.0030.01315.71
5.6.10.0120.00615.62
5.6.00.0130.00315.81

preferences:
68.55 ms | 401 KiB | 5 Q