3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Base{ protected $funcs = []; public function __call($name, $args) { echo("\t>>>Call [$name](". json_encode($args). ") \r\n"); 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.0060.00918.43
8.3.50.0100.01122.00
8.3.40.0060.01018.67
8.3.30.0140.00019.04
8.3.20.0040.00420.34
8.3.10.0040.00421.73
8.3.00.0000.00820.95
8.2.180.0110.00416.50
8.2.170.0090.00622.96
8.2.160.0100.01020.39
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0090.00019.52
8.2.110.0060.00320.85
8.2.100.0110.00019.39
8.2.90.0060.00317.84
8.2.80.0050.00318.03
8.2.70.0040.00417.90
8.2.60.0030.00618.28
8.2.50.0040.00419.41
8.2.40.0040.00419.47
8.2.30.0040.00420.39
8.2.20.0080.00017.65
8.2.10.0000.00818.21
8.2.00.0080.00017.70
8.1.280.0040.01425.92
8.1.270.0060.00318.88
8.1.260.0000.00826.35
8.1.250.0030.00528.09
8.1.240.0100.00022.21
8.1.230.0060.00622.71
8.1.220.0050.00317.76
8.1.210.0030.00518.77
8.1.200.0060.00317.35
8.1.190.0060.00317.23
8.1.180.0000.00818.10
8.1.170.0050.00318.72
8.1.160.0040.00418.84
8.1.150.0040.00418.96
8.1.140.0000.00717.48
8.1.130.0030.00317.88
8.1.120.0040.00417.56
8.1.110.0000.00717.55
8.1.100.0040.00417.50
8.1.90.0000.00717.50
8.1.80.0040.00417.51
8.1.70.0080.00017.39
8.1.60.0060.00617.52
8.1.50.0050.00317.48
8.1.40.0050.00317.55
8.1.30.0090.00017.69
8.1.20.0040.00417.59
8.1.10.0040.00417.61
8.1.00.0040.00417.52
8.0.300.0000.00719.77
8.0.290.0060.00316.63
8.0.280.0000.00818.52
8.0.270.0000.00717.24
8.0.260.0060.00017.21
8.0.250.0040.00416.90
8.0.240.0000.00716.91
8.0.230.0030.00316.88
8.0.220.0000.00816.91
8.0.210.0070.00016.96
8.0.200.0070.00017.06
8.0.190.0080.00016.96
8.0.180.0020.00516.97
8.0.170.0030.00516.96
8.0.160.0040.00416.79
8.0.150.0000.00816.89
8.0.140.0020.00516.82
8.0.130.0030.00313.33
8.0.120.0030.00516.79
8.0.110.0080.00016.84
8.0.100.0030.00516.84
8.0.90.0040.00416.93
8.0.80.0130.00316.98
8.0.70.0030.00616.77
8.0.60.0040.00416.91
8.0.50.0040.00416.98
8.0.30.0140.00717.22
8.0.20.0130.00717.40
8.0.10.0000.00717.00
8.0.00.0070.01016.67
7.4.330.0050.00015.03
7.4.320.0030.00316.68
7.4.300.0030.00316.68
7.4.290.0040.00416.54
7.4.280.0050.00316.69
7.4.270.0070.00016.52
7.4.260.0000.00816.56
7.4.250.0000.00716.42
7.4.240.0010.00616.67
7.4.230.0000.00716.45
7.4.220.0150.00316.62
7.4.210.0150.00016.51
7.4.200.0030.00316.66
7.4.160.0070.00716.60
7.4.150.0080.01217.40
7.4.140.0060.01417.86
7.4.130.0060.01016.65
7.4.120.0130.00316.60
7.4.110.0120.00816.50
7.4.100.0100.01416.53
7.4.90.0030.01516.61
7.4.80.0130.00619.39
7.4.70.0120.00616.75
7.4.60.0100.00616.60
7.4.50.0060.00316.43
7.4.40.0100.00716.50
7.4.30.0100.01116.58
7.4.00.0080.00814.93
7.3.330.0000.00813.35
7.3.320.0000.00513.32
7.3.310.0080.00016.40
7.3.300.0040.00416.29
7.3.290.0050.00816.38
7.3.280.0110.00516.36
7.3.270.0100.00717.40
7.3.260.0070.01316.46
7.3.250.0080.00916.43
7.3.240.0100.00716.57
7.3.230.0070.01316.57
7.3.210.0140.00416.64
7.3.200.0200.00019.39
7.3.190.0060.00916.51
7.3.180.0070.01016.67
7.3.170.0100.01016.53
7.3.160.0040.01216.46
7.2.330.0060.01616.56
7.2.320.0100.01016.92
7.2.310.0060.01216.79
7.2.300.0120.01216.84
7.2.290.0100.00716.48
7.2.00.0030.01219.67
7.1.200.0030.01015.84
7.1.100.0110.00418.43
7.1.70.0040.00816.92
7.1.60.0060.01019.14
7.1.50.0030.01717.00
7.1.00.0100.07022.54
7.0.200.0040.00416.86
7.0.140.0070.05322.18
7.0.90.0400.04719.88
7.0.80.0100.05320.04
7.0.70.0000.07719.92
7.0.60.0030.08319.87
7.0.50.0070.08720.19
7.0.40.0070.04720.19
7.0.30.0070.04320.18
7.0.20.0030.06319.99
7.0.10.0100.07320.14
7.0.00.0130.06020.09
5.6.280.0030.07321.17
5.6.240.0100.04720.65
5.6.230.0030.07320.56
5.6.220.0000.05020.60
5.6.210.0170.08020.78
5.6.200.0100.08021.06
5.6.190.0070.08321.19
5.6.180.0130.07320.98
5.6.170.0200.07021.15
5.6.160.0100.06021.05
5.6.150.0030.08021.07
5.6.140.0170.04320.96
5.6.130.0130.04020.98
5.6.120.0070.08320.98
5.6.110.0100.05721.19
5.6.100.0000.09021.03
5.6.90.0000.08720.94
5.6.80.0100.04020.37
5.6.70.0030.04720.36
5.6.60.0030.08020.41
5.6.50.0070.04720.32
5.6.40.0170.07320.54
5.6.30.0100.06320.48
5.6.20.0170.06320.38
5.6.10.0100.05720.32
5.6.00.0030.07720.31
5.5.380.0100.07020.59
5.5.370.0130.07720.52
5.5.360.0000.08320.38
5.5.350.0100.08020.39
5.5.340.0070.08320.94
5.5.330.0170.06720.92
5.5.320.0070.07020.80
5.5.310.0130.07320.75
5.5.300.0100.08020.75
5.5.290.0070.08320.92
5.5.280.0130.04020.82
5.5.270.0100.03320.82
5.5.260.0030.08320.95
5.5.250.0170.07320.71
5.5.240.0100.04320.24
5.5.230.0070.07020.21
5.5.220.0000.05720.19
5.5.210.0130.07320.32
5.5.200.0030.04320.21
5.5.190.0070.08320.02
5.5.180.0030.05020.20
5.5.160.0070.05720.02
5.5.150.0030.08320.13
5.5.140.0230.07020.25
5.5.130.0100.07020.25
5.5.120.0170.06720.25
5.5.110.0100.06020.12
5.5.100.0070.04720.19
5.5.90.0100.07019.97
5.5.80.0070.06319.97
5.5.70.0130.06020.18
5.5.60.0030.07020.02
5.5.50.0000.08020.16
5.5.40.0100.04020.02
5.5.30.0070.07720.18
5.5.20.0100.07020.05
5.5.10.0100.08320.15
5.5.00.0100.07019.99
5.4.450.0030.08319.27
5.4.440.0000.04719.38
5.4.430.0070.08319.50
5.4.420.0070.05719.46
5.4.410.0070.04719.14
5.4.400.0100.07319.06
5.4.390.0100.07719.03
5.4.380.0100.07719.09
5.4.370.0100.03319.03
5.4.360.0070.07019.12
5.4.350.0030.04019.18
5.4.340.0170.06718.91
5.4.320.0200.04019.23
5.4.310.0100.06319.18
5.4.300.0030.07018.86
5.4.290.0100.07718.88
5.4.280.0130.06719.03
5.4.270.0030.05319.12
5.4.260.0030.06019.16
5.4.250.0070.07719.12
5.4.240.0030.04318.84
5.4.230.0030.04719.04
5.4.220.0000.04719.11
5.4.210.0070.05319.08
5.4.200.0070.08018.89
5.4.190.0030.08018.89
5.4.180.0130.07019.03
5.4.170.0100.08019.13
5.4.160.0130.06319.02
5.4.150.0100.07319.05
5.4.140.0100.07016.43
5.4.130.0030.07716.43
5.4.120.0170.03316.25
5.4.110.0030.04716.52
5.4.100.0000.07316.39
5.4.90.0070.04716.52
5.4.80.0200.06016.54
5.4.70.0130.06316.38
5.4.60.0070.07016.45
5.4.50.0100.06716.47
5.4.40.0030.05016.38
5.4.30.0030.06016.45
5.4.20.0070.06316.43
5.4.10.0100.04316.31
5.4.00.0070.07015.86
5.3.290.0030.04314.59
5.3.280.0070.04014.73
5.3.270.0030.08314.55
5.3.260.0170.06014.55
5.3.250.0030.04714.70
5.3.240.0170.06314.61
5.3.230.0170.06014.66
5.3.220.0000.04314.53
5.3.210.0130.05714.62
5.3.200.0030.04314.63
5.3.190.0100.08014.57
5.3.180.0170.05714.49
5.3.170.0100.07714.49
5.3.160.0000.05014.62
5.3.150.0070.08014.54
5.3.140.0100.07014.55
5.3.130.0030.06714.51
5.3.120.0130.04014.59
5.3.110.0030.07314.47
5.3.100.0070.07013.98
5.3.90.0100.05014.03
5.3.80.0000.05713.93
5.3.70.0100.04314.11
5.3.60.0100.04314.05
5.3.50.0100.06714.07
5.3.40.0070.07314.05
5.3.30.0070.04314.02
5.3.20.0000.06713.57
5.3.10.0070.05313.55
5.3.00.0000.06713.54
5.2.170.0030.06011.22
5.2.160.0070.06011.14
5.2.150.0070.03311.13
5.2.140.0070.03011.22
5.2.130.0100.05311.21
5.2.120.0070.05711.00
5.2.110.0070.04710.95
5.2.100.0030.04311.14
5.2.90.0030.06311.10
5.2.80.0100.05711.15
5.2.70.0030.05711.15
5.2.60.0000.05711.16
5.2.50.0070.05311.07
5.2.40.0100.05711.10
5.2.30.0000.06011.02
5.2.20.0100.03710.89
5.2.10.0000.06010.97
5.2.00.0000.05710.85
5.1.60.0030.04010.09
5.1.50.0030.05310.02
5.1.40.0100.0509.99
5.1.30.0030.05710.23
5.1.20.0000.06010.45
5.1.10.0030.0509.90
5.1.00.0000.0539.91
5.0.50.0000.0438.62
5.0.40.0100.0238.48
5.0.30.0100.0578.21
5.0.20.0130.0178.28
5.0.10.0030.0438.02
5.0.00.0030.0678.00
4.4.90.0000.0377.13
4.4.80.0070.0277.13
4.4.70.0030.0177.13
4.4.60.0000.0277.13
4.4.50.0000.0237.13
4.4.40.0030.0537.13
4.4.30.0000.0377.13
4.4.20.0030.0377.13
4.4.10.0000.0377.13
4.4.00.0030.0437.13
4.3.110.0030.0277.13
4.3.100.0000.0237.13
4.3.90.0100.0277.13
4.3.80.0100.0437.13
4.3.70.0000.0407.13
4.3.60.0030.0277.13
4.3.50.0000.0377.13
4.3.40.0170.0377.13
4.3.30.0000.0337.13
4.3.20.0000.0337.13
4.3.10.0000.0307.13
4.3.00.0000.0377.13

preferences:
64.47 ms | 401 KiB | 5 Q