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) { $as = explode('=', $yes); 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.'>'); } } const NewLine = "<br />"; const 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.0140.00716.74
8.3.50.0100.01117.47
8.3.40.0120.00318.68
8.3.30.0160.00018.54
8.3.20.0000.00818.63
8.3.10.0040.00420.55
8.3.00.0190.00319.13
8.2.180.0070.01316.75
8.2.170.0110.00422.96
8.2.160.0080.00520.44
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0050.00319.23
8.2.110.0060.00321.14
8.2.100.0100.00318.09
8.2.90.0030.00619.08
8.2.80.0000.00817.97
8.2.70.0000.00817.93
8.2.60.0030.00518.04
8.2.50.0090.00018.10
8.2.40.0050.00320.46
8.2.30.0080.00018.04
8.2.20.0050.00317.62
8.2.10.0050.00217.66
8.2.00.0030.00617.73
8.1.280.0100.00325.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0070.00323.84
8.1.230.0060.00620.30
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0080.00017.35
8.1.190.0030.00617.22
8.1.180.0030.00518.10
8.1.170.0000.00818.55
8.1.160.0050.00318.90
8.1.150.0060.00318.74
8.1.140.0000.00717.40
8.1.130.0070.00017.68
8.1.120.0000.00717.41
8.1.110.0070.00017.36
8.1.100.0070.00017.36
8.1.90.0040.00417.48
8.1.80.0000.00717.43
8.1.70.0000.00717.45
8.1.60.0000.00817.48
8.1.50.0040.00417.51
8.1.40.0060.00317.41
8.1.30.0000.00817.51
8.1.20.0000.00717.56
8.1.10.0000.00717.43
8.1.00.0050.00317.33
8.0.300.0000.00718.77
8.0.290.0040.00416.75
8.0.280.0030.00318.44
8.0.270.0000.00717.38
8.0.260.0000.00616.94
8.0.250.0000.00717.07
8.0.240.0080.00017.04
8.0.230.0000.00717.09
8.0.220.0030.00316.93
8.0.210.0030.00316.88
8.0.200.0000.00716.98
8.0.190.0040.00417.04
8.0.180.0040.00417.00
8.0.170.0060.00316.89
8.0.160.0000.00816.87
8.0.150.0000.00916.84
8.0.140.0030.00516.89
8.0.130.0030.00313.36
8.0.120.0000.00816.96
8.0.110.0040.00416.85
8.0.100.0030.00516.98
8.0.90.0050.00317.04
8.0.80.0150.00616.91
8.0.70.0040.00416.84
8.0.60.0040.00416.74
8.0.50.0030.00616.78
8.0.30.0070.01317.12
8.0.20.0130.00717.09
8.0.10.0000.00716.94
8.0.00.0110.01116.95
7.4.330.0050.00013.06
7.4.320.0000.00616.48
7.4.300.0030.00316.59
7.4.290.0000.00716.68
7.4.280.0040.00416.61
7.4.270.0070.00016.69
7.4.260.0030.00313.30
7.4.250.0060.00316.64
7.4.240.0030.00316.61
7.4.230.0030.00316.52
7.4.220.0120.00816.73
7.4.210.0070.01016.71
7.4.200.0040.00416.41
7.4.190.0030.00516.64
7.4.160.0140.00316.51
7.4.150.0080.01216.72
7.4.140.0070.01116.70
7.4.130.0060.01516.70
7.4.120.0070.01016.58
7.4.110.0120.01216.82
7.4.100.0100.01016.66
7.4.90.0140.00316.78
7.4.80.0080.01519.39
7.4.70.0150.00416.77
7.4.60.0020.02116.41
7.4.50.0060.00016.32
7.4.40.0040.01216.64
7.4.30.0060.00916.40
7.4.10.0070.01014.93
7.4.00.0040.01215.09
7.3.330.0000.00613.37
7.3.320.0070.00013.34
7.3.310.0070.00016.49
7.3.300.0000.00716.47
7.3.290.0120.00316.46
7.3.280.0050.01016.47
7.3.270.0090.00916.54
7.3.260.0080.00816.57
7.3.250.0100.00816.58
7.3.240.0160.00416.54
7.3.230.0120.01316.66
7.3.210.0150.00916.52
7.3.200.0070.01016.57
7.3.190.0130.00516.67
7.3.180.0060.00916.51
7.3.170.0060.01016.61
7.3.160.0030.01916.55
7.3.130.0030.01315.12
7.3.120.0070.00815.11
7.3.110.0040.01515.05
7.3.100.0000.01015.12
7.3.90.0070.00714.86
7.3.80.0030.00914.91
7.3.70.0000.01014.97
7.3.60.0040.01115.08
7.3.50.0070.01015.10
7.3.40.0000.00814.88
7.3.30.0070.00714.89
7.3.20.0110.00416.76
7.3.10.0110.00316.66
7.3.00.0090.00616.76
7.2.330.0090.00816.93
7.2.320.0170.00016.82
7.2.310.0100.01316.73
7.2.300.0070.01616.95
7.2.290.0070.01016.96
7.2.260.0090.00914.95
7.2.250.0090.00915.30
7.2.240.0070.00715.25
7.2.230.0160.00015.11
7.2.220.0030.00715.14
7.2.210.0070.00715.07
7.2.200.0040.01115.23
7.2.190.0090.00615.20
7.2.180.0060.00615.34
7.2.170.0030.00715.07
7.2.160.0060.01015.31
7.2.150.0090.00616.93
7.2.140.0070.01016.82
7.2.130.0080.00316.75
7.2.120.0040.01516.89
7.2.110.0040.00716.94
7.2.100.0040.01117.07
7.2.90.0040.01117.01
7.2.80.0030.01016.78
7.2.70.0070.00716.97
7.2.60.0000.01017.02
7.2.50.0070.01117.15
7.2.40.0080.00816.98
7.2.30.0060.00317.03
7.2.20.0070.01016.85
7.2.10.0000.01417.20
7.2.00.0110.00316.97
7.1.330.0000.01315.82
7.1.320.0070.01115.48
7.1.310.0030.00915.71
7.1.300.0100.00715.88
7.1.290.0000.00916.05
7.1.280.0070.00715.72
7.1.270.0040.00415.93
7.1.260.0000.01015.68
7.1.250.0100.00315.94
7.1.240.0070.00315.84
7.1.230.0030.00915.54
7.1.220.0070.00715.90
7.1.210.0000.01315.88
7.1.200.0070.01015.95
7.1.190.0090.00415.95
7.1.180.0000.01815.85
7.1.170.0080.00415.82
7.1.160.0040.01115.96
7.1.150.0030.01315.82
7.1.140.0030.01316.04
7.1.130.0030.01315.75
7.1.120.0150.00015.64
7.1.110.0060.00615.92
7.1.100.0030.00615.75
7.1.90.0000.01015.71
7.1.80.0090.00615.60
7.1.70.0050.00716.48
7.1.60.0100.01017.59
7.1.50.0050.01216.30
7.1.40.0060.00915.57
7.1.30.0060.00615.93
7.1.20.0060.00315.97
7.1.10.0000.01515.82
7.1.00.0080.03518.96
7.0.330.0070.01015.66
7.0.320.0040.00415.42
7.0.310.0000.00815.55
7.0.300.0080.00815.13
7.0.290.0060.00615.25
7.0.280.0030.01415.27
7.0.270.0030.01315.38
7.0.260.0060.00315.47
7.0.250.0000.01515.47
7.0.240.0030.01315.45
7.0.230.0070.00715.54
7.0.220.0070.00715.47
7.0.210.0000.01615.52
7.0.200.0180.00715.10
7.0.190.0060.00315.36
7.0.180.0060.00315.30
7.0.170.0100.00315.51
7.0.160.0030.01015.53
7.0.150.0060.00615.24
7.0.140.0080.03618.59
7.0.130.0030.01415.61
7.0.120.0050.02518.89
7.0.110.0100.00315.39
7.0.100.0130.00015.46
7.0.90.0130.00315.55
7.0.80.0090.00615.31
7.0.70.0080.00315.18
7.0.60.0020.04418.76
7.0.50.0050.04716.88
7.0.40.0070.04316.70
7.0.30.0130.04316.79
7.0.20.0100.02816.97
7.0.10.0100.03316.85
7.0.00.0030.05016.70
5.6.400.0030.00714.61
5.6.390.0060.01214.75
5.6.380.0030.00714.74
5.6.370.0030.00614.54
5.6.360.0060.00614.79
5.6.350.0080.00014.56
5.6.340.0030.01314.74
5.6.330.0090.00614.53
5.6.320.0070.01014.65
5.6.310.0070.01114.53
5.6.300.0110.00014.50
5.6.290.0070.01014.88
5.6.280.0050.04217.80
5.6.270.0040.00714.37
5.6.260.0070.01014.74
5.6.250.0030.00914.28
5.6.240.0070.01114.64
5.6.230.0060.00914.43
5.6.220.0140.00014.60
5.6.210.0080.03817.53
5.6.200.0050.02616.41
5.6.190.0100.04217.65
5.6.180.0150.02317.58
5.6.170.0180.04117.50
5.6.160.0040.04817.55
5.6.150.0080.04016.32
5.6.140.0070.03316.23
5.6.130.0070.03016.47
5.6.120.0110.04117.89
5.6.110.0060.02317.84
5.6.100.0100.03017.74
5.6.90.0130.03617.85
5.6.80.0060.04317.51
5.6.70.0070.00714.72
5.6.60.0070.01114.18
5.6.50.0040.00714.43
5.6.40.0030.01314.27
5.6.30.0000.01114.35
5.6.20.0060.00614.37
5.6.10.0090.00314.59
5.6.00.0030.00614.45
5.5.380.0090.00614.21
5.5.370.0100.00314.77
5.5.360.0000.01214.77
5.5.350.0130.03617.56
5.5.340.0010.05016.42
5.5.330.0150.02517.50
5.5.320.0170.03717.52
5.5.310.0110.03917.17
5.5.300.0050.04716.17
5.5.290.0020.02616.21
5.5.280.0080.03817.53
5.5.270.0070.04217.64
5.5.260.0080.03217.63
5.5.250.0050.02617.65
5.5.240.0150.02517.51
5.5.230.0070.00714.19
5.5.220.0090.00914.41
5.5.210.0100.00314.63
5.5.200.0030.01014.52
5.5.190.0000.01314.64
5.5.180.0080.00414.59
5.5.170.0060.00614.22
5.5.160.0070.00414.25
5.5.150.0070.00314.19
5.5.140.0100.00314.38
5.5.130.0030.00914.51
5.5.120.0120.00314.58
5.5.110.0100.00714.21
5.5.100.0070.00614.43
5.5.90.0100.00714.24
5.5.80.0000.01114.31
5.5.70.0040.00914.51
5.5.60.0000.01014.41
5.5.50.0060.00314.14
5.5.40.0040.01114.48
5.5.30.0000.00914.30
5.5.20.0080.00414.44
5.5.10.0000.01414.39
5.5.00.0030.00714.68
5.4.450.0050.02016.07
5.4.440.0020.03616.06
5.4.430.0000.02416.20
5.4.420.0030.02216.17
5.4.410.0050.02416.19
5.4.400.0050.04016.10
5.4.390.0050.04216.08
5.4.380.0050.02415.96
5.4.370.0050.04115.91
5.4.360.0080.03815.99
5.4.350.0070.03716.10
5.4.340.0090.02315.90
5.4.330.0030.00612.95
5.4.320.0020.04516.02
5.4.310.0040.02715.90
5.4.300.0040.04215.91
5.4.290.0020.02916.04
5.4.280.0050.04116.09
5.4.270.0030.04515.91
5.4.260.0070.03316.02
5.4.250.0030.02716.09
5.4.240.0050.03515.97
5.4.230.0070.03216.10
5.4.220.0060.03816.07
5.4.210.0020.03716.09
5.4.200.0050.03916.07
5.4.190.0050.02715.97
5.4.180.0100.02815.97
5.4.170.0080.04116.07
5.4.160.0020.02716.09
5.4.150.0050.02215.97
5.4.140.0080.03514.69
5.4.130.0080.03714.63
5.4.120.0070.01914.67
5.4.110.0060.04114.71
5.4.100.0030.03014.63
5.4.90.0030.02214.71
5.4.80.0030.03914.76
5.4.70.0090.03914.70
5.4.60.0040.03514.72
5.4.50.0030.02214.70
5.4.40.0040.03514.74
5.4.30.0080.03514.69
5.4.20.0020.03514.70
5.4.10.0060.02214.70
5.4.00.0030.02514.39
5.3.290.0030.02413.83
5.3.280.0070.02013.80
5.3.270.0030.03013.80
5.3.260.0030.02813.83
5.3.250.0020.02613.81
5.3.240.0030.03313.81
5.3.230.0030.03913.83
5.3.220.0030.03213.78
5.3.210.0100.03613.79
5.3.200.0030.02813.79
5.3.190.0050.03813.82
5.3.180.0050.04013.74
5.3.170.0030.03513.85
5.3.160.0030.02713.78
5.3.150.0050.02513.81
5.3.140.0090.03313.79
5.3.130.0050.02713.77
5.3.120.0020.02513.73
5.3.110.0020.02813.78
5.3.100.0050.02213.52
5.3.90.0020.04213.58
5.3.80.0110.01813.58
5.3.70.0050.03813.51
5.3.60.0030.04113.52
5.3.50.0050.03313.42
5.3.40.0030.03913.42
5.3.30.0050.03013.40
5.3.20.0030.04113.32
5.3.10.0080.03613.42
5.3.00.0070.03813.34
5.2.170.0000.04311.13
5.2.160.0070.04011.14
5.2.150.0030.03011.24
5.2.140.0070.05711.06
5.2.130.0070.06011.11
5.2.120.0070.05311.21
5.2.110.0030.05711.18
5.2.100.0030.07311.13
5.2.90.0070.04711.29
5.2.80.0000.03711.28
5.2.70.0070.05311.12
5.2.60.0030.05311.14
5.2.50.0100.05711.20
5.2.40.0070.03310.99
5.2.30.0030.03310.89
5.2.20.0000.03011.04
5.2.10.0100.04710.89
5.2.00.0100.02310.66
5.1.60.0000.02710.07
5.1.50.0030.05710.04
5.1.40.0000.05010.16
5.1.30.0100.05310.32
5.1.20.0070.05710.30
5.1.10.0100.04310.01
5.1.00.0030.03710.10
5.0.50.0030.0208.75
5.0.40.0000.0308.45
5.0.30.0030.0678.34
5.0.20.0000.0308.38
5.0.10.0030.0478.20
5.0.00.0030.0678.22
4.4.90.0030.0307.76
4.4.80.0000.0237.76
4.4.70.0000.0177.76
4.4.60.0000.0307.76
4.4.50.0000.0277.76
4.4.40.0070.0407.76
4.4.30.0030.0277.76
4.4.20.0030.0377.76
4.4.10.0000.0377.76
4.4.00.0000.0477.76
4.3.110.0100.0307.76
4.3.100.0000.0337.76
4.3.90.0000.0337.76
4.3.80.0030.0407.76
4.3.70.0070.0177.76
4.3.60.0100.0277.76
4.3.50.0070.0307.76
4.3.40.0000.0407.76
4.3.30.0000.0207.76
4.3.20.0000.0337.76
4.3.10.0000.0237.76
4.3.00.0000.0207.76

preferences:
62.56 ms | 401 KiB | 5 Q