3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace app; define('YII_ENV_PROD', false); class BaseObject { protected $enableFriendClassesInProd = false; protected $calledClassStackLimit = 0; protected $friendParents = false; protected $friendDescendants = false; protected $friendClasses = []; public function __call($name, $args) { if (method_exists($this, $name) && method_exists($this, '_call')) { if (!YII_ENV_PROD || $enableFriendClassesInProd ) { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $this->calledClassStackLimit); $stackClasses = array_column($backtrace, 'class'); $calledClass = array_pop($stackClasses); if (in_array($calledClass, $this->friendClasses)) { return call_user_func_array([$this, '_call'], [$name, $args]); } elseif ($this->friendDescendants && is_subclass_of($calledClass, static::class)) { return call_user_func_array([$this, '_call'], [$name, $args]); } elseif ($this->friendParents && is_subclass_of(static::class, $calledClass)) { return call_user_func_array([$this, '_call'], [$name, $args]); } else { throw new \Exception('Method disallowed: ' . get_class($this) . '::' . $name); } } return call_user_func_array([$this, '_call'], [$name, $args]); } else { throw new \Exception('Calling unknown method:' . get_class($this) . '::' . $name); } } public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { return $this->$getter(); } elseif (method_exists($this, 'set' . $name)) { throw new \Exception('Getting write-only property: ' . get_class($this) . '::' . $name); } throw new \Exception('Getting unknown property: ' . get_class($this) . '::' . $name); } public function __set($name, $value) { $setter = 'set' . $name; if (method_exists($this, $setter)) { $this->$setter($value); } elseif (method_exists($this, 'get' . $name)) { throw new \Exception('Setting read-only property: ' . get_class($this) . '::' . $name); } else { throw new \Exception('Setting unknown property: ' . get_class($this) . '::' . $name); } } } class Yii { public static $app; } class A extends BaseObject { protected $friendDescendants = true; private function showName() { echo __CLASS__; } protected function _call($name, $args) { return call_user_func_array([$this, $name], $args); } } class B extends A { public function myName() { Yii::$app->showName(); } } Yii::$app = new A(); $b = new B(); $b->myName();

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.4.120.0140.00620.75
8.4.110.0060.00218.95
8.4.100.0130.00817.66
8.4.90.0130.00817.78
8.4.80.0050.00517.90
8.4.70.0070.01319.47
8.4.60.0140.00717.71
8.4.50.0100.01018.75
8.4.40.0120.00319.64
8.4.30.0080.00018.80
8.4.20.0100.01020.52
8.4.10.0040.00417.68
8.3.250.0140.00519.21
8.3.240.0110.00816.75
8.3.230.0110.00917.00
8.3.220.0070.00817.47
8.3.210.0040.01116.65
8.3.200.0130.00716.91
8.3.190.0110.01016.77
8.3.180.0110.00916.66
8.3.170.0100.00720.88
8.3.160.0170.00318.61
8.3.150.0090.00917.34
8.3.140.0160.00618.84
8.3.130.0060.00318.61
8.3.120.0100.00619.31
8.3.110.0050.00516.63
8.3.100.0060.00318.41
8.3.90.0100.01026.77
8.3.80.0110.00019.36
8.3.70.0090.00616.75
8.3.60.0100.01018.56
8.3.50.0050.01123.68
8.3.40.0030.01218.82
8.3.30.0040.01118.84
8.3.20.0080.00021.92
8.3.10.0050.00321.92
8.3.00.0080.00023.65
8.2.290.0150.00520.39
8.2.280.0100.00818.65
8.2.270.0130.00717.25
8.2.260.0110.00716.69
8.2.250.0040.01518.36
8.2.240.0040.01218.85
8.2.230.0040.00420.94
8.2.220.0070.00424.06
8.2.210.0050.00326.77
8.2.200.0090.00018.88
8.2.190.0040.01118.41
8.2.180.0110.00416.75
8.2.170.0080.00822.96
8.2.160.0120.00620.66
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0080.00026.16
8.2.110.0070.00320.49
8.2.100.0030.00917.71
8.2.90.0090.00018.03
8.2.80.0080.00017.97
8.2.70.0080.00017.63
8.2.60.0050.00317.77
8.2.50.0080.00018.05
8.2.40.0040.00418.28
8.2.30.0000.00819.44
8.2.20.0000.00818.04
8.2.10.0000.00719.31
8.2.00.0030.00619.23
8.1.330.0100.00916.71
8.1.320.0100.01016.50
8.1.310.0070.00018.69
8.1.300.0030.00619.48
8.1.290.0090.00030.84
8.1.280.0150.00625.92
8.1.270.0080.00022.02
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0100.00022.39
8.1.230.0120.00021.09
8.1.220.0040.00417.78
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0000.00817.62
8.1.160.0030.00518.88
8.1.150.0030.00518.99
8.1.140.0000.00820.71
8.1.130.0030.00320.40
8.1.120.0030.00317.61
8.1.110.0040.00417.55
8.1.100.0040.00417.52
8.1.90.0080.00017.37
8.1.80.0090.00017.59
8.1.70.0000.00717.46
8.1.60.0030.00517.56
8.1.50.0000.00917.50
8.1.40.0090.00017.62
8.1.30.0080.00417.73
8.1.20.0080.00017.68
8.1.10.0000.00817.59
8.1.00.0000.00717.47
8.0.300.0040.00420.11
8.0.290.0040.00416.75
8.0.280.0000.00718.43
8.0.270.0070.00018.19
8.0.260.0000.00720.21
8.0.250.0000.00716.99
8.0.240.0030.00317.04
8.0.230.0000.00717.04
8.0.220.0000.00716.91
8.0.210.0030.00316.97
8.0.200.0070.00017.04
8.0.190.0040.00316.91
8.0.180.0050.00316.90
8.0.170.0030.00616.94
8.0.160.0000.00716.90
8.0.150.0030.00516.82
8.0.140.0000.00816.89
8.0.130.0060.00013.38
8.0.120.0040.00416.97
8.0.110.0000.00716.82
8.0.100.0040.00416.97
8.0.90.0090.00016.93
8.0.80.0090.00916.96
8.0.70.0050.00316.87
8.0.60.0040.00416.77
8.0.50.0040.00417.00
8.0.30.0140.00317.15
8.0.20.0120.00617.25
8.0.10.0000.00817.06
8.0.00.0060.01216.74
7.4.330.0000.00516.77
7.4.320.0000.00616.67
7.4.300.0000.00616.61
7.4.290.0000.00716.47
7.4.280.0000.01016.66
7.4.270.0100.00016.44
7.4.260.0060.00013.37
7.4.250.0000.00716.59
7.4.240.0030.00416.48
7.4.230.0000.00716.58
7.4.220.0070.00016.60
7.4.210.0070.00816.61
7.4.200.0000.00716.51
7.4.130.0130.01016.50
7.4.120.0150.00616.53
7.4.110.0090.00916.57
7.4.100.0060.01216.43
7.4.90.0130.00316.59
7.4.80.0110.00719.39
7.4.70.0140.00316.55
7.4.60.0090.00916.74
7.4.50.0070.01116.32
7.4.40.0120.00916.55
7.4.20.0060.01116.70
7.4.10.0130.00716.48
7.4.00.0100.01016.63
7.3.330.0020.00516.43
7.3.320.0000.00513.29
7.3.310.0000.00616.30
7.3.300.0030.00316.33
7.3.290.0070.00816.36
7.3.280.0090.00616.32
7.3.260.0110.01416.30
7.3.240.0070.01216.51
7.3.230.0070.01116.38
7.3.210.0100.00616.74
7.3.200.0100.00716.50
7.3.190.0140.00416.36
7.3.180.0080.01116.58
7.3.170.0100.01116.55
7.3.160.0100.00616.71
7.3.130.0060.00916.36
7.3.120.0090.01116.30
7.3.110.0110.00416.48
7.3.100.0070.00816.40
7.3.90.0040.01116.23
7.3.80.0070.01116.74
7.3.70.0040.01116.39
7.3.60.0040.01116.32
7.3.50.0080.01416.24
7.3.40.0070.01016.48
7.3.30.0080.00816.18
7.3.20.0180.00616.47
7.3.10.0160.00616.42
7.3.00.0120.00616.51
7.2.330.0070.01016.81
7.2.320.0130.00316.83
7.2.310.0100.00716.49
7.2.300.0080.01316.64
7.2.290.0090.00916.79
7.2.260.0130.00316.83
7.2.250.0070.00716.66
7.2.240.0060.00916.47
7.2.230.0100.00716.90
7.2.220.0110.01216.82
7.2.210.0040.01116.50
7.2.200.0060.00916.77
7.2.190.0100.00516.68
7.2.180.0120.00916.68
7.2.170.0030.01316.68
7.2.160.0070.01016.86
7.2.150.0160.00316.90
7.2.140.0130.01016.75
7.2.130.0080.01016.68
7.2.120.0060.01416.72
7.2.110.0160.00316.87
7.2.100.0070.01416.83
7.2.90.0140.00716.70
7.2.80.0110.00716.57
7.2.70.0080.00816.68
7.2.60.0060.01216.83
7.2.50.0080.01416.62
7.2.40.0070.01316.73
7.2.30.0070.01716.64
7.2.20.0130.01316.82
7.2.10.0130.00416.62
7.2.00.0140.00816.75

preferences:
27.13 ms | 403 KiB | 5 Q