3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Base{ protected $funcs = []; public function __call($name, $args) { error_log("\t>>>Call [$name](". json_encode($args). ") \r\n",3, LOGFILE); if (method_exists($this, $name)) { return call_user_func_array($this->$name, $args); } else if (isset($this->funcs[ $name ])) { return call_user_func_array($this->funcs[ $name ], $args); } else { throw new Exception("Method <$name> is not accessible."); } } /** * @param array $args * * @example new Base(["field1"=>"value1", "field2"=>"value2"]) * if u need override __constructor, then use: * __construct($args){ * .. * parent::__construct($args); * } */ public function __construct($args = []) { $nameClass = get_class($this); #region auto create methods 'hasField' for everyone field\property (if there exists getter or setter) $properties = get_class_vars($nameClass); $keys = array_keys($properties); foreach ($keys AS $k) { if ((method_exists($this, "set" . ucfirst($k)) || method_exists($this, "get" . ucfirst($k))) && (!method_exists($this, "has" . ucfirst($k) && !isset($this->funcs["has" . ucfirst($k)]))) ) { $v = &$this->$k; $this->funcs["has" . ucfirst($k)] = function () use (&$v) { return !empty($v); }; } } #endregion foreach ($args as $k => $v) { if (property_exists($nameClass, $k)) { $this->$k = $v; } } } } class Test extends Base{ protected $field1; public function setField1($v){$this->field1 = $v;} public function getField1(){return $this->field1;} } $test = new Test(); $test->setField1(23423); echo $test->hasField1();

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.0040.01118.68
8.3.50.0160.00621.13
8.3.40.0080.00818.92
8.3.30.0100.00319.17
8.3.20.0070.00020.04
8.3.10.0030.00521.73
8.3.00.0030.00620.71
8.2.180.0090.01317.00
8.2.170.0110.00422.96
8.2.160.0070.00720.45
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0000.00819.77
8.2.110.0060.00322.14
8.2.100.0110.00019.15
8.2.90.0000.00817.88
8.2.80.0060.00317.97
8.2.70.0060.00318.05
8.2.60.0040.00418.22
8.2.50.0060.00319.27
8.2.40.0030.00621.23
8.2.30.0000.00720.39
8.2.20.0040.00417.86
8.2.10.0000.00718.23
8.2.00.0000.00817.80
8.1.280.0180.00025.92
8.1.270.0030.00519.00
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00822.14
8.1.230.0030.00919.09
8.1.220.0030.00517.76
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0090.00018.54
8.1.160.0040.00418.82
8.1.150.0050.00218.82
8.1.140.0000.00817.49
8.1.130.0000.00717.78
8.1.120.0000.00717.40
8.1.110.0070.00017.50
8.1.100.0050.00317.38
8.1.90.0000.00717.54
8.1.80.0040.00417.56
8.1.70.0070.00017.50
8.1.60.0030.00717.54
8.1.50.0030.00617.56
8.1.40.0080.00017.61
8.1.30.0030.00617.69
8.1.20.0080.00017.67
8.1.10.0080.00017.60
8.1.00.0000.00817.60
8.0.300.0090.00319.91
8.0.290.0040.00416.75
8.0.280.0050.00218.55
8.0.270.0080.00017.17
8.0.260.0000.00617.18
8.0.250.0000.00717.05
8.0.240.0060.00016.91
8.0.230.0000.00716.97
8.0.220.0030.00616.99
8.0.210.0000.00917.00
8.0.200.0030.00317.01
8.0.190.0040.00417.05
8.0.180.0040.00417.05
8.0.170.0000.00917.06
8.0.160.0030.00417.02
8.0.150.0040.00416.96
8.0.140.0040.00416.85
8.0.130.0000.00613.36
8.0.120.0040.00416.89
8.0.110.0000.00816.98
8.0.100.0000.00717.02
8.0.90.0040.00416.80
8.0.80.0210.00016.98
8.0.70.0030.00516.97
8.0.60.0040.00416.98
8.0.50.0050.00316.90
8.0.30.0070.01717.10
8.0.20.0090.00917.40
8.0.10.0000.00716.90
8.0.00.0120.00916.83
7.4.330.0050.00015.03
7.4.320.0000.00716.66
7.4.300.0030.00316.68
7.4.290.0070.00016.61
7.4.280.0000.00716.68
7.4.270.0000.00716.55
7.4.260.0000.00816.51
7.4.250.0000.00816.51
7.4.240.0050.00316.52
7.4.230.0030.00316.47
7.4.220.0090.00916.54
7.4.210.0040.01116.61
7.4.200.0000.00716.48
7.4.160.0030.01116.71
7.4.150.0060.01317.40
7.4.140.0100.00617.86
7.4.130.0060.01116.57
7.4.120.0120.00616.61
7.4.110.0110.00716.59
7.4.100.0140.00616.58
7.4.90.0110.01116.59
7.4.80.0170.00719.39
7.4.70.0100.00716.60
7.4.60.0070.01016.52
7.4.50.0000.00416.47
7.4.40.0040.01216.38
7.4.30.0170.00716.78
7.4.00.0070.00715.20
7.3.330.0040.00413.21
7.3.320.0000.00513.45
7.3.310.0070.00016.40
7.3.300.0040.00416.53
7.3.290.0060.00716.46
7.3.280.0090.00816.49
7.3.270.0100.00717.40
7.3.260.0090.00916.49
7.3.250.0090.00916.51
7.3.240.0080.00816.73
7.3.230.0160.00016.39
7.3.210.0030.01416.48
7.3.200.0110.00719.39
7.3.190.0050.01116.68
7.3.180.0000.01616.41
7.3.170.0100.01016.49
7.3.160.0110.00516.73
7.2.330.0060.01616.74
7.2.320.0030.01516.55
7.2.310.0260.01216.86
7.2.300.0100.01416.87
7.2.290.0030.01416.93
7.2.60.0070.01016.68
7.2.00.0030.01319.35
7.1.200.0050.00515.79
7.1.100.0210.00717.78
7.1.70.0120.00317.20
7.1.60.0150.00619.14
7.1.50.0040.01817.11
7.1.00.0070.07322.52
7.0.200.0000.00716.85
7.0.140.0000.04021.96
7.0.90.0670.07019.88
7.0.80.0330.05719.89
7.0.70.0500.05019.95
7.0.60.0170.08019.93
7.0.50.0500.05720.34
7.0.40.0030.08020.05
7.0.30.0130.07720.00
7.0.20.0100.03720.10
7.0.10.0030.04020.12
7.0.00.0030.08720.07
5.6.280.0070.07321.10
5.6.240.0070.05020.61
5.6.230.0000.09020.60
5.6.220.0130.06320.66
5.6.210.0200.07320.69
5.6.200.0070.08721.13
5.6.190.0230.06721.10
5.6.180.0070.07721.16
5.6.170.0070.04321.03
5.6.160.0100.07720.96
5.6.150.0100.06021.06
5.6.140.0130.08021.12
5.6.130.0070.08721.06
5.6.120.0070.05020.96
5.6.110.0000.05321.03
5.6.100.0030.04321.09
5.6.90.0170.07720.94
5.6.80.0170.05720.34
5.6.70.0000.08720.36
5.6.60.0130.06320.46
5.6.50.0000.09020.31
5.6.40.0100.08020.41
5.6.30.0070.07720.46
5.6.20.0100.07320.44
5.6.10.0030.05720.45
5.6.00.0100.05020.31
5.5.380.0070.04020.40
5.5.370.0130.07720.32
5.5.360.0030.09020.38
5.5.350.0070.06020.30
5.5.340.0070.05020.92
5.5.330.0130.07320.86
5.5.320.0100.07720.85
5.5.310.0030.08320.75
5.5.300.0070.05720.79
5.5.290.0000.05020.88
5.5.280.0030.08320.83
5.5.270.0070.09020.89
5.5.260.0000.04720.79
5.5.250.0100.08020.64
5.5.240.0130.07720.32
5.5.230.0070.04020.27
5.5.220.0100.07720.32
5.5.210.0130.07720.18
5.5.200.0170.06320.24
5.5.190.0070.05320.21
5.5.180.0070.04720.15
5.5.160.0000.09020.14
5.5.150.0070.06720.25
5.5.140.0130.06720.25
5.5.130.0130.08020.21
5.5.120.0130.07320.20
5.5.110.0100.07720.25
5.5.100.0170.07020.14
5.5.90.0030.05720.17
5.5.80.0130.07320.09
5.5.70.0100.07320.18
5.5.60.0070.07720.18
5.5.50.0070.05020.08
5.5.40.0100.05320.11
5.5.30.0100.07720.05
5.5.20.0100.06019.98
5.5.10.0030.04720.00
5.5.00.0170.07020.15
5.4.450.0030.07319.24
5.4.440.0000.06319.27
5.4.430.0000.05019.37
5.4.420.0030.04719.53
5.4.410.0030.07319.12
5.4.400.0070.07018.91
5.4.390.0070.05319.05
5.4.380.0070.04018.94
5.4.370.0030.06319.05
5.4.360.0100.07319.21
5.4.350.0170.05019.05
5.4.340.0030.08019.20
5.4.320.0170.06719.16
5.4.310.0070.06719.18
5.4.300.0070.06019.23
5.4.290.0030.08019.03
5.4.280.0100.07719.03
5.4.270.0130.07318.89
5.4.260.0100.03719.13
5.4.250.0070.07319.02
5.4.240.0230.03019.24
5.4.230.0170.07319.22
5.4.220.0030.08019.04
5.4.210.0100.07319.13
5.4.200.0100.07319.20
5.4.190.0000.05019.11
5.4.180.0100.06319.04
5.4.170.0100.07718.86
5.4.160.0070.05319.21
5.4.150.0130.07319.11
5.4.140.0070.07316.44
5.4.130.0070.07316.41
5.4.120.0100.03316.25
5.4.110.0100.07316.32
5.4.100.0000.05316.45
5.4.90.0070.04016.49
5.4.80.0030.05316.32
5.4.70.0030.03716.51
5.4.60.0000.05016.46
5.4.50.0000.07316.34
5.4.40.0030.07316.31
5.4.30.0130.07016.32
5.4.20.0070.03716.30
5.4.10.0070.07016.46
5.4.00.0170.06315.86
5.3.290.0100.07014.73
5.3.280.0100.05314.65
5.3.270.0130.07014.55
5.3.260.0030.07714.69
5.3.250.0070.07714.61
5.3.240.0100.04014.59
5.3.230.0000.08314.58
5.3.220.0100.05014.62
5.3.210.0100.07314.70
5.3.200.0030.07714.52
5.3.190.0100.06714.68
5.3.180.0070.04014.48
5.3.170.0130.05014.48
5.3.160.0130.03014.55
5.3.150.0030.04314.48
5.3.140.0030.04314.66
5.3.130.0000.07714.50
5.3.120.0100.06314.63
5.3.110.0070.03714.66
5.3.100.0130.07014.13
5.3.90.0070.06714.14
5.3.80.0030.04314.15
5.3.70.0030.05714.04
5.3.60.0070.06314.11
5.3.50.0070.07713.83
5.3.40.0000.08013.97
5.3.30.0100.06713.91
5.3.20.0030.04313.74
5.3.10.0130.06313.58
5.3.00.0030.05013.70
5.2.170.0070.05311.24
5.2.160.0030.06311.25
5.2.150.0130.05011.24
5.2.140.0130.05311.18
5.2.130.0030.04011.14
5.2.120.0100.02311.08
5.2.110.0070.05711.14
5.2.100.0000.03311.11
5.2.90.0000.03011.20
5.2.80.0030.06310.94
5.2.70.0130.04311.20
5.2.60.0030.06710.90
5.2.50.0070.06011.11
5.2.40.0000.04711.07
5.2.30.0130.05010.90
5.2.20.0070.05311.00
5.2.10.0030.06710.97
5.2.00.0070.05710.80
5.1.60.0100.03310.09
5.1.50.0030.05310.10
5.1.40.0000.03710.02
5.1.30.0070.05310.41
5.1.20.0030.03010.26
5.1.10.0070.0409.95
5.1.00.0030.05310.15
5.0.50.0030.0478.39
5.0.40.0000.0338.29
5.0.30.0030.0538.30
5.0.20.0030.0378.30
5.0.10.0030.0438.23
5.0.00.0030.0378.25
4.4.90.0030.0136.86
4.4.80.0000.0306.86
4.4.70.0000.0376.86
4.4.60.0070.0276.86
4.4.50.0000.0276.86
4.4.40.0030.0506.86
4.4.30.0000.0236.86
4.4.20.0030.0336.86
4.4.10.0000.0376.86
4.4.00.0000.0476.86
4.3.110.0000.0206.86
4.3.100.0030.0336.86
4.3.90.0000.0376.86
4.3.80.0100.0476.86
4.3.70.0030.0336.86
4.3.60.0000.0276.86
4.3.50.0000.0306.86
4.3.40.0030.0276.86
4.3.30.0000.0236.86
4.3.20.0000.0376.86
4.3.10.0030.0336.86
4.3.00.0000.0406.86

preferences:
51.53 ms | 401 KiB | 5 Q