3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Element { private $single, $tag, $value, $attr=array(); public function __construct($tag, $single = false) { $this->tag = $tag; $this->single = $single; } public function Value($value) { $this->value = $value; } public function AddAttr($attr, $list = false) { if ($list) { array_merge($this->attr, $list); } else { array_push($this->attr, $attr); } } public function GetAttr($name = null) { if ($i === null) { return $this->attr; } else { return $this->attr[$name]; } } public function AttrFromString($string) { $items = explode(" ", $string); $newlist = array(); foreach($items as $yes) { if (strpos($yes, "=")) { $as = explode('=', $yes); } else { $as[0] = $yes; $as[1] = ""; } if (substr($as[1], 0,1) == "'" || substr($as[1], 0,1) == '"') { $as[1] = substr($as[1],1,strlen($as)-1); } array_push($newlist, new Attribute($as[0], $as[1])); } array_merge($this->attr, $newlist); } public function SetAttr($name, $value) { $this->attr[$name] = $value; } public function RemoveAttr($name = null) { if ($name === null) { $attr = array(); } else { unset($attr[$name]); } } public function __toString() { return "<" . $this->tag . " " . implode(" ",$this->attr) . ($this->single ? (!empty($this->value) ? "value='" . $this->value ."'" : "" ). "/>" : '>' . $this->value . '</'.$this->tag.'>'); } } define(NewLine, "<br />"); define(DocType, '<!DOCTYPE html>'); class Attribute { private $name, $value; public function __construct($name, $value = "") { $this->name = $name; $this->value = $value; } public function Name($name = null) { if ($name === null) { return $this->name; } else { $this->name = $name; } } public function Value($value = null) { if ($value === null) { return $this->value; } else { $this->value = $value; } } public function __toString() { if (is_array($this->value)) { $code = ""; foreach ($this->value as $key => $value) { $code .= $key . ":" . $value . ';'; } } return ($this->value === true ? $this->name : ($this->value === false ? "" : ($this->value === "" ? $this->name : $this->name . "='".(is_array($this->value) ? $code : $this->value ). "'"))); } } $element = new Element("a"); $element->AddAttr(new Attribute("href", "http://google.nl")); $element->AddAttr(new Attribute("target", "_blank")); $element2 = new Element("span"); $element2->AddAttr(new Attribute("style", array("color" => "orange","background-color" => "green"))); $element2->Value("doei"); $element2->AttrFromString("required"); $element3 = new Element("img", true); $element3->AddAttr(new Attribute("src", "https://si0.twimg.com/profile_images/3439429669/c2c9d02095be44d026d358e0a39bced0_normal.jpeg")); $element->Value($element2 . NewLine. "hoi" .NewLine . $element3); echo $element;

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.0110.00417.00
8.3.50.0130.00618.11
8.3.40.0070.00718.71
8.3.30.0090.00918.72
8.3.20.0080.00018.77
8.3.10.0080.00020.45
8.3.00.0060.00319.25
8.2.180.0100.01325.92
8.2.170.0060.01018.80
8.2.160.0070.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0080.00020.48
8.2.110.0090.00020.40
8.2.100.0080.00417.91
8.2.90.0000.00818.28
8.2.80.0070.00019.28
8.2.70.0000.00917.63
8.2.60.0030.00517.93
8.2.50.0040.00718.07
8.2.40.0040.00418.34
8.2.30.0040.00418.19
8.2.20.0030.00617.64
8.2.10.0060.00317.73
8.2.00.0080.00017.92
8.1.280.0080.01225.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0050.00522.37
8.1.230.0040.00721.09
8.1.220.0030.00517.88
8.1.210.0060.00318.97
8.1.200.0060.00617.48
8.1.190.0030.00517.52
8.1.180.0000.00918.10
8.1.170.0070.00319.02
8.1.160.0000.00718.81
8.1.150.0040.00418.50
8.1.140.0000.00817.34
8.1.130.0000.00817.79
8.1.120.0070.00017.47
8.1.110.0020.00517.47
8.1.100.0030.00517.45
8.1.90.0000.00717.49
8.1.80.0040.00417.37
8.1.70.0070.00017.41
8.1.60.0040.00417.59
8.1.50.0000.00817.35
8.1.40.0040.00417.51
8.1.30.0030.00617.53
8.1.20.0040.00417.50
8.1.10.0070.00017.61
8.1.00.0000.00817.46
8.0.300.0000.00720.27
8.0.290.0030.00617.00
8.0.280.0050.00218.57
8.0.270.0000.00817.33
8.0.260.0030.00316.96
8.0.250.0000.00717.03
8.0.240.0040.00417.13
8.0.230.0070.00017.06
8.0.220.0070.00017.03
8.0.210.0000.00717.06
8.0.200.0000.00717.06
8.0.190.0050.00317.11
8.0.180.0040.00417.06
8.0.170.0040.00416.94
8.0.160.0000.00717.06
8.0.150.0040.00416.96
8.0.140.0030.00617.03
8.0.130.0030.00313.55
8.0.120.0000.00817.01
8.0.110.0000.00816.81
8.0.100.0000.00816.85
8.0.90.0000.00917.07
8.0.80.0100.01016.99
8.0.70.0000.00816.93
8.0.60.0050.00516.91
8.0.50.0000.00716.89
8.0.30.0060.01517.36
8.0.20.0070.01017.25
8.0.10.0000.00717.21
8.0.00.0140.00816.68
7.4.330.0050.00013.02
7.4.320.0030.00316.70
7.4.300.0040.00416.63
7.4.290.0080.00016.66
7.4.280.0060.00316.54
7.4.270.0070.00016.60
7.4.260.0060.00013.39
7.4.250.0080.00016.66
7.4.240.0000.00716.64
7.4.230.0030.00316.79
7.4.220.0030.01516.46
7.4.210.0000.01416.65
7.4.200.0070.00016.72
7.4.190.0030.00316.84
7.4.160.0110.00516.54
7.4.150.0060.01316.47
7.4.140.0060.01116.64
7.4.130.0070.01016.72
7.4.120.0140.00316.59
7.4.110.0040.01316.63
7.4.100.0170.00716.54
7.4.90.0120.00616.73
7.4.80.0060.01319.39
7.4.70.0030.01616.66
7.4.60.0030.01316.53
7.4.50.0000.00516.53
7.4.40.0140.00016.56
7.4.30.0060.01116.52
7.4.00.0080.00614.92
7.3.330.0000.00613.51
7.3.320.0030.00313.46
7.3.310.0040.00416.49
7.3.300.0070.00016.39
7.3.290.0070.00916.52
7.3.280.0030.01216.47
7.3.270.0070.01016.58
7.3.260.0060.01316.60
7.3.250.0070.01016.64
7.3.240.0060.01616.36
7.3.230.0040.01416.50
7.3.210.0060.01316.61
7.3.200.0130.00716.45
7.3.190.0160.00616.49
7.3.180.0030.01316.55
7.3.170.0070.01016.51
7.3.160.0060.01316.72
7.3.120.0090.00614.98
7.3.110.0000.01414.84
7.3.100.0090.00614.80
7.3.90.0070.00715.00
7.3.80.0030.01414.55
7.3.70.0030.01414.95
7.3.60.0000.01514.95
7.3.50.0100.00315.02
7.3.40.0040.00714.64
7.3.30.0060.00915.04
7.3.20.0060.00316.44
7.3.10.0060.00916.43
7.3.00.0000.01416.73
7.2.330.0130.00516.55
7.2.320.0180.00616.80
7.2.310.0090.01016.83
7.2.300.0090.01616.66
7.2.290.0090.00916.87
7.2.240.0060.01215.30
7.2.230.0000.01415.08
7.2.220.0080.00815.18
7.2.210.0040.01515.18
7.2.200.0040.01115.11
7.2.190.0110.00415.32
7.2.180.0000.01414.98
7.2.170.0040.01115.12
7.2.160.0000.01515.04
7.2.150.0070.00716.95
7.2.140.0030.00716.86
7.2.130.0080.00317.09
7.2.120.0030.00716.73
7.2.110.0060.01217.09
7.2.100.0030.01316.71
7.2.90.0030.01016.97
7.2.80.0000.01016.79
7.2.70.0000.01316.93
7.2.60.0050.00516.84
7.2.50.0070.00716.98
7.2.40.0070.01017.02
7.2.30.0030.01016.78
7.2.20.0110.00016.95
7.2.10.0060.00916.94
7.2.00.0100.00016.80
7.1.330.0000.01415.87
7.1.320.0040.01215.63
7.1.310.0000.01015.74
7.1.300.0060.00615.84
7.1.290.0000.01215.85
7.1.280.0000.00815.70
7.1.270.0000.01215.61
7.1.260.0040.01115.74
7.1.250.0040.01115.48
7.1.200.0070.00715.93
7.1.100.0040.00818.23
7.1.70.0000.00817.29
7.1.60.0060.01919.31
7.1.50.0070.01416.76
7.1.00.0030.05322.35
7.0.200.0480.00014.98
7.0.140.0030.07721.95
7.0.120.0030.07322.02
7.0.60.0130.07720.09
7.0.50.0130.07317.95
7.0.40.0070.05320.13
7.0.30.0200.05320.28
7.0.20.0170.04320.15
7.0.10.0030.06320.33
7.0.00.0100.06020.20
5.6.280.0100.06720.80
5.6.210.0130.07320.58
5.6.200.0130.04718.21
5.6.190.0130.08020.61
5.6.180.0330.06720.67
5.6.170.0230.04020.44
5.6.160.0130.07720.46
5.6.150.0170.07718.22
5.6.140.0100.03718.21
5.6.130.0070.08318.30
5.6.120.0100.03721.16
5.6.110.0130.08021.04
5.6.100.0070.08321.00
5.6.90.0070.06020.99
5.6.80.0170.07320.42
5.5.350.0200.05320.51
5.5.340.0030.08317.99
5.5.330.0070.09020.35
5.5.320.0400.06320.31
5.5.310.0370.06020.36
5.5.300.0100.08017.97
5.5.290.0130.07318.04
5.5.280.0070.08320.92
5.5.270.0030.05020.72
5.5.260.0030.04320.84
5.5.250.0000.04320.73
5.5.240.0100.07020.30
5.4.450.0030.07719.44
5.4.440.0030.06719.46
5.4.430.0100.07719.17
5.4.420.0030.05319.32
5.4.410.0170.07019.32
5.4.400.0000.05719.16
5.4.390.0030.07718.93
5.4.380.0070.05719.19
5.4.370.0200.06319.12
5.4.360.0100.08019.00
5.4.350.0030.04719.14
5.4.340.0070.03719.18
5.4.320.0130.06019.25
5.4.310.0130.07018.98
5.4.300.0100.07318.92
5.4.290.0000.05019.14
5.4.280.0000.08019.24
5.4.270.0030.05318.85
5.4.260.0130.07019.20
5.4.250.0130.07318.84
5.4.240.0030.06718.86
5.4.230.0070.07319.23
5.4.220.0070.04019.14
5.4.210.0000.08018.84
5.4.200.0100.03319.16
5.4.190.0170.06719.13
5.4.180.0070.06719.11
5.4.170.0030.06318.96
5.4.160.0200.05719.05
5.4.150.0030.05719.10
5.4.140.0100.06716.43
5.4.130.0100.04016.36
5.4.120.0030.07316.42
5.4.110.0100.07316.58
5.4.100.0070.04316.35
5.4.90.0200.06316.43
5.4.80.0100.06316.45
5.4.70.0070.05716.46
5.4.60.0070.03716.45
5.4.50.0070.04716.55
5.4.40.0030.06716.69
5.4.30.0100.07316.31
5.4.20.0030.06016.47
5.4.10.0070.07316.36
5.4.00.0070.07715.87
5.3.290.0130.07014.75
5.3.280.0070.07714.64
5.3.270.0070.08014.67
5.3.260.0030.08014.69
5.3.250.0030.04314.70
5.3.240.0100.05014.80
5.3.230.0030.04014.68
5.3.220.0070.07714.64
5.3.210.0030.07314.63
5.3.200.0070.07714.67
5.3.190.0030.06014.69
5.3.180.0000.04014.77
5.3.170.0130.07714.54
5.3.160.0100.07714.76
5.3.150.0030.08714.69
5.3.140.0100.05314.62
5.3.130.0030.08014.59
5.3.120.0070.07714.60
5.3.110.0030.04314.61
5.3.100.0070.07714.13
5.3.90.0130.06014.08
5.3.80.0000.07313.96
5.3.70.0030.04714.12
5.3.60.0030.06714.21
5.3.50.0100.07013.95
5.3.40.0100.06314.07
5.3.30.0130.06713.96
5.3.20.0070.07713.79
5.3.10.0070.04013.78
5.3.00.0030.04713.72
5.2.170.0030.03311.21
5.2.160.0070.02711.21
5.2.150.0030.07011.16
5.2.140.0170.03311.17
5.2.130.0030.06311.16
5.2.120.0030.04011.23
5.2.110.0030.03011.15
5.2.100.0030.05711.20
5.2.90.0000.04311.21
5.2.80.0030.03311.21
5.2.70.0030.05711.30
5.2.60.0070.06311.07
5.2.50.0100.05711.04
5.2.40.0030.05010.98
5.2.30.0100.04710.98
5.2.20.0100.05711.03
5.2.10.0030.06711.06
5.2.00.0030.06310.69
5.1.60.0070.0579.96
5.1.50.0100.04010.03
5.1.40.0030.04010.10
5.1.30.0030.03710.43
5.1.20.0030.05310.46
5.1.10.0100.02710.10
5.1.00.0000.03310.13
5.0.50.0000.0378.68
5.0.40.0100.0378.38
5.0.30.0100.0578.31
5.0.20.0000.0278.31
5.0.10.0070.0438.16
5.0.00.0000.0378.28
4.4.90.0030.0278.05
4.4.80.0000.0238.05
4.4.70.0000.0308.05
4.4.60.0030.0208.05
4.4.50.0000.0208.05
4.4.40.0030.0538.05
4.4.30.0030.0338.05
4.4.20.0000.0178.05
4.4.10.0000.0278.05
4.4.00.0000.0538.05
4.3.110.0030.0178.05
4.3.100.0030.0138.05
4.3.90.0030.0308.05
4.3.80.0000.0338.05
4.3.70.0030.0138.05
4.3.60.0000.0208.05
4.3.50.0000.0178.05
4.3.40.0070.0178.05
4.3.30.0030.0138.05
4.3.20.0000.0178.05
4.3.10.0000.0178.05
4.3.00.0030.0138.05

preferences:
55.4 ms | 400 KiB | 5 Q