3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Element { var $single = null; var $tag = null; var $value= null; var $attr=array(); function __construct($tag, $single = false) { $this->tag = $tag; $this->single = $single; } function Value($value) { $this->value = $value; } function AddAttr($attr, $list = false) { if ($list) { $this->attr = array_merge($this->attr, $list); } else { array_push($this->attr, $attr); } } function GetAttr($name = null) { if ($i === null) { return $this->attr; } else { foreach($this->attr as $try) { if ($try->Name() === $name) { return $this->attr[$name]; } } return new Attribute(""); } } function SetAttr($name, $value) { $exist = false; foreach($this->attr as $try) { if ($try->Name() === $name) { $try->Value($value); $exist = true; } } if (!$exist) { array_push($this->attr, new Attr($name, $value)); } } function AttrFromString($string) { $items = explode(" ", $string); $newlist = array(); foreach($items as $yes) { if (strpos($yes, "=")!==false) { $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])-2); } array_push($newlist, new Attribute($as[0], $as[1])); } $this->attr = array_merge($this->attr, $newlist); } function RemoveAttr($name = null) { if ($name === null) { $this->attr = array(); } else { for($i = 0; $i < count($this->attr); $i++) { if ($this->attr[$i]->Name() === $name) { unset($this->attr[$i]); } } } } 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 { var $name = null; var $value = null; function __construct($name, $value = "") { $this->name = $name; $this->value = $value; } function Name($name = null) { if ($name === null) { return $this->name; } else { $this->name = $name; } } function Value($value = null) { if ($value === null) { return $this->value; } else { $this->value = $value; } } 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 ). "'"))); } } $a = new Element("a"); $a->AddAttr(new Attribute("href", "http://twitter.nl")); $a->AddAttr(new Attribute("target", "_blank")); $span = new Element("span"); $span->AddAttr(new Attribute("style", array("color" => "orange","background-color" => "green"))); $span->Value("doei"); //Ads Doei in Span $span->AttrFromString("rel='none'"); //Adds Rel to None $img = new Element("img", true); //Makes Img Element $img->AddAttr(new Attribute("src", "https://www.google.nl/images/srpr/logo4w.png")); //Adds SRC $a->RemoveAttr("href"); //Removes Href Attribute $a->Value($span . NewLine. "hello world" .NewLine . $img); //Changes Inner Html of the A echo $a;

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.40.0110.00418.67
8.3.30.0040.01419.09
8.3.20.0060.00320.21
8.3.10.0070.00023.56
8.3.00.0050.00320.68
8.2.170.0040.01122.96
8.2.160.0100.00322.11
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0070.00021.03
8.2.110.0060.00322.07
8.2.100.0090.00317.97
8.2.90.0000.00919.03
8.2.80.0050.00317.97
8.2.70.0030.00617.75
8.2.60.0030.00518.04
8.2.50.0090.00018.07
8.2.40.0050.00517.97
8.2.30.0050.00218.08
8.2.20.0050.00217.81
8.2.10.0030.00617.89
8.2.00.0030.00517.71
8.1.270.0030.00623.91
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.97
8.1.230.0060.00617.45
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0040.00417.47
8.1.190.0080.00017.53
8.1.180.0040.00418.10
8.1.170.0060.00318.84
8.1.160.0000.00721.98
8.1.150.0080.00018.58
8.1.140.0040.00417.45
8.1.130.0000.01017.96
8.1.120.0080.00017.45
8.1.110.0030.00517.41
8.1.100.0070.00017.45
8.1.90.0030.00617.49
8.1.80.0040.00417.52
8.1.70.0000.00717.48
8.1.60.0050.00317.62
8.1.50.0040.00417.39
8.1.40.0050.00317.46
8.1.30.0080.00017.56
8.1.20.0040.00417.65
8.1.10.0040.00417.36
8.1.00.0040.00417.28
8.0.300.0040.00418.77
8.0.290.0070.00016.88
8.0.280.0030.00318.48
8.0.270.0040.00417.36
8.0.260.0040.00416.84
8.0.250.0040.00417.06
8.0.240.0030.00416.97
8.0.230.0050.00316.90
8.0.220.0070.00017.00
8.0.210.0030.00416.90
8.0.200.0030.00316.98
8.0.190.0050.00317.04
8.0.180.0040.00417.07
8.0.170.0080.00017.07
8.0.160.0090.00017.03
8.0.150.0040.00417.04
8.0.140.0080.00016.90
8.0.130.0030.00313.39
8.0.120.0040.00416.88
8.0.110.0000.00716.97
8.0.100.0040.00416.82
8.0.90.0000.00817.04
8.0.80.0000.01516.95
8.0.70.0040.00416.88
8.0.60.0000.00716.81
8.0.50.0040.00417.00
8.0.30.0120.00717.14
8.0.20.0060.01317.40
8.0.10.0040.00416.91
8.0.00.0140.00516.81
7.4.330.0000.00515.09
7.4.320.0000.00616.52
7.4.300.0000.00716.61
7.4.290.0030.00316.51
7.4.280.0060.00316.48
7.4.270.0000.00716.62
7.4.260.0000.00716.61
7.4.250.0000.00716.55
7.4.240.0020.00516.48
7.4.230.0000.00716.62
7.4.220.0060.01216.66
7.4.210.0120.00516.61
7.4.200.0050.00316.71
7.4.190.0000.00716.55
7.4.160.0140.00716.35
7.4.150.0040.01317.40
7.4.140.0120.00917.86
7.4.130.0060.01116.60
7.4.120.0100.00816.57
7.4.110.0030.01416.54
7.4.100.0070.01416.63
7.4.90.0110.00716.47
7.4.80.0100.01016.68
7.4.70.0080.00816.66
7.4.60.0170.00016.66
7.4.50.0000.00916.61
7.4.40.0080.00522.77
7.4.30.0140.00316.63
7.4.00.0030.01015.21
7.3.330.0060.00013.34
7.3.320.0000.00513.45
7.3.310.0030.00316.41
7.3.300.0000.00716.44
7.3.290.0070.00716.47
7.3.280.0070.01016.45
7.3.270.0090.00917.40
7.3.260.0130.00716.42
7.3.250.0140.00716.54
7.3.240.0090.00916.45
7.3.230.0110.00616.66
7.3.210.0060.01216.73
7.3.200.0100.01419.39
7.3.190.0160.03116.71
7.3.180.0060.00916.39
7.3.170.0130.01616.69
7.3.160.0110.00516.78
7.3.120.0100.00715.15
7.3.10.0070.00716.48
7.3.00.0030.00616.57
7.2.330.0150.00316.75
7.2.320.0080.00816.89
7.2.310.0030.00116.66
7.2.300.0140.00316.90
7.2.290.0100.00716.88
7.2.130.0100.00616.98
7.2.120.0060.00316.92
7.2.110.0030.01016.64
7.2.100.0030.01017.04
7.2.90.0070.00417.11
7.2.80.0080.00416.72
7.2.70.0100.00317.01
7.2.60.0040.00817.01
7.2.50.0000.01516.59
7.2.40.0030.00916.93
7.2.30.0060.00616.82
7.2.20.0120.00017.10
7.2.10.0000.00916.96
7.2.00.0110.00718.20
7.1.250.0090.00615.58
7.1.200.0060.00915.73
7.1.100.0070.00418.19
7.1.70.0030.00717.08
7.1.60.0030.02119.32
7.1.50.0120.00916.96
7.1.00.0030.07722.43
7.0.200.0040.00816.82
7.0.140.0070.06722.05
7.0.100.0170.05320.04
7.0.90.0170.08020.01
7.0.80.0100.07320.01
7.0.70.0270.07720.03
7.0.60.0130.05320.02
7.0.50.0070.07020.38
7.0.40.0070.06720.19
7.0.30.0070.08020.14
7.0.20.0030.07720.11
7.0.10.0100.08320.10
7.0.00.0000.04320.08
5.6.280.0030.07320.83
5.6.250.0100.07720.64
5.6.240.0130.08020.71
5.6.230.0070.08020.79
5.6.220.0070.08720.63
5.6.210.0070.04320.65
5.6.200.0030.05321.07
5.6.190.0200.03321.11
5.6.180.0070.06721.11
5.6.170.0030.04321.09
5.6.160.0000.06321.05
5.6.150.0100.04021.22
5.6.140.0170.07021.15
5.6.130.0100.07321.13
5.6.120.0070.05021.14
5.6.110.0070.07721.09
5.6.100.0070.08321.02
5.6.90.0070.08321.20
5.6.80.0070.05020.60
5.6.70.0130.05720.50
5.6.60.0030.05720.44
5.6.50.0130.07320.45
5.6.40.0030.05020.48
5.6.30.0100.08020.36
5.6.20.0100.07720.39
5.6.10.0030.08020.36
5.6.00.0130.07720.46
5.5.380.0070.04020.49
5.5.370.0130.03720.40
5.5.360.0130.07720.43
5.5.350.0070.07020.52
5.5.340.0100.08320.90
5.5.330.0030.07320.97
5.5.320.0030.08720.81
5.5.310.0070.08720.96
5.5.300.0070.08320.82
5.5.290.0070.07320.88
5.5.280.0130.07320.84
5.5.270.0130.07720.96
5.5.260.0100.07320.96
5.5.250.0070.04720.73
5.5.240.0130.05320.32
5.5.230.0100.04720.30
5.5.220.0070.08320.06
5.5.210.0100.08320.23
5.5.200.0070.07720.13
5.5.190.0070.05020.25
5.5.180.0000.08720.16
5.5.160.0070.09020.17
5.5.150.0130.08020.27
5.5.140.0100.08720.12
5.5.130.0070.04720.28
5.5.120.0130.06720.28
5.5.110.0130.07720.21
5.5.100.0200.06320.23
5.5.90.0170.03720.21
5.5.80.0100.09720.07
5.5.70.0070.08720.08
5.5.60.0100.07720.10
5.5.50.0070.07020.11
5.5.40.0170.02720.09
5.5.30.0170.05720.09
5.5.20.0070.04320.19
5.5.10.0070.07320.17
5.5.00.0100.05020.09
5.4.450.0070.05319.54
5.4.440.0030.07719.38
5.4.430.0100.03719.27
5.4.420.0130.06019.36
5.4.410.0070.04319.38
5.4.400.0000.05019.10
5.4.390.0130.06719.23
5.4.380.0030.06319.04
5.4.370.0100.07019.13
5.4.360.0070.08319.04
5.4.350.0070.08019.03
5.4.340.0230.06019.03
5.4.320.0100.07319.21
5.4.310.0100.08718.85
5.4.300.0030.07319.03
5.4.290.0030.08019.08
5.4.280.0130.07019.02
5.4.270.0070.06719.04
5.4.260.0070.05018.98
5.4.250.0000.08319.13
5.4.240.0030.05019.04
5.4.230.0130.05718.86
5.4.220.0070.05719.12
5.4.210.0070.06719.11
5.4.200.0130.06319.12
5.4.190.0070.05319.11
5.4.180.0070.07318.86
5.4.170.0130.06718.91
5.4.160.0130.06019.02
5.4.150.0130.05019.02
5.4.140.0000.06016.25
5.4.130.0100.06316.51
5.4.120.0030.07316.49
5.4.110.0030.07716.55
5.4.100.0100.06016.54
5.4.90.0170.08016.48
5.4.80.0070.04016.53
5.4.70.0130.06716.38
5.4.60.0070.06716.37
5.4.50.0100.07016.39
5.4.40.0030.06016.37
5.4.30.0070.05016.42
5.4.20.0030.07316.36
5.4.10.0000.05016.32
5.4.00.0030.07715.84
5.3.290.0170.06314.71
5.3.280.0030.08314.77
5.3.270.0130.06314.70
5.3.260.0130.03314.77
5.3.250.0070.06014.66
5.3.240.0100.06014.71
5.3.230.0100.07314.71
5.3.220.0030.08014.62
5.3.210.0100.07314.72
5.3.200.0070.07314.61
5.3.190.0100.07314.69
5.3.180.0070.05714.55
5.3.170.0070.06014.73
5.3.160.0070.07314.77
5.3.150.0100.07014.76
5.3.140.0100.07314.54
5.3.130.0100.05714.75
5.3.120.0070.07014.67
5.3.110.0030.05014.64
5.3.100.0070.07014.11
5.3.90.0030.07314.06
5.3.80.0070.04314.00
5.3.70.0070.06014.11
5.3.60.0030.05014.09
5.3.50.0030.08013.96
5.3.40.0070.08014.10
5.3.30.0030.04313.95
5.3.20.0070.07013.81
5.3.10.0070.04313.85
5.3.00.0030.04313.76

preferences:
40.6 ms | 400 KiB | 5 Q