3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Shape { abstract protected function getArea(); public function toStringArea(){ return "The area of the " . get_called_class() . " is ".$this->getArea() . "\n"; } public function toStringPerimeter(){ return "The perimeter of the " . get_called_class() . " is ".$this->getPerimeter() . "\n"; } } class Rectangle extends Shape{ private $l; private $b; public function __construct($l,$b) { $this->l=$l; $this->b=$b; } protected function getArea(){ return $this->l * $this->b; } protected function getPerimeter(){ return 2 * $this->l + 2 * $this->b; } } class Triangle extends Shape{ private $l; private $b; public function __construct($l,$b) { $this->l=$l; $this->b=$b; } protected function getArea(){ return $this->l * $this->b * 0.5; } protected function getPerimeter(){ return $this->l + $this->b + sqrt($this->l * $this->l + $this->b * $this->l); } } class Circle extends Shape{ private $r; public function __construct($r) { $this->r=$r; } protected function getArea(){ return $this->r*$this->r*3.14; } protected function getPerimeter(){ return $this->r*2*3.14; } } echo' <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Show Hide Using Selectbox</title> <style type="text/css"> .box{ padding: 20px; display: none; margin-top: 20px; border: 1px solid #000; } .red{ background: #ff0000; } .green{ background: #00ff00; } .blue{ background: #0000ff; } </style> <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("select").change(function(){ $( "select option:selected").each(function(){ if($(this).attr("value")=="red"){ $(".box").hide(); $(".red").show(); alert("Bam!"); } if($(this).attr("value")=="green"){ $(".box").hide(); $(".green").show(); } if($(this).attr("value")=="blue"){ $(".box").hide(); $(".blue").show(); } }); }).change(); }); </script> </head> <body> <div> <select> <option>Choose Color</option> <option value="red">Red</option> <option value="green">Green</option> <option value="blue">Blue</option> </select> </div> <div class="red box">You have selected <strong>red option</strong> so i am here</div> <div class="green box">You have selected <strong>green option</strong> so i am here</div> <div class="blue box">You have selected <strong>blue option</strong> so i am here</div> '; echo '<p>'; $r = new Rectangle(5, 4); echo $r->toStringArea() . "<br>"; echo $r->toStringPerimeter() . "<p>"; $c = new Circle(10); echo $c->toStringArea() . "<br>"; echo $c->toStringPerimeter() . "<p>"; $t = new Triangle(5, 4); echo $t->toStringArea() . "<br>"; echo $t->toStringPerimeter() . "<p>"; echo ' </body> </html> ';

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.0150.01216.50
8.3.50.0080.00722.11
8.3.40.0110.00418.84
8.3.30.0060.00819.21
8.3.20.0060.00320.33
8.3.10.0040.00420.43
8.3.00.0000.00819.26
8.2.180.0110.01116.50
8.2.170.0100.00722.96
8.2.160.0080.00620.41
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0090.00026.16
8.2.120.0070.00022.14
8.2.110.0030.00622.08
8.2.100.0000.01118.05
8.2.90.0080.00019.13
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0090.00017.93
8.2.50.0030.00618.07
8.2.40.0070.00318.17
8.2.30.0040.00419.54
8.2.20.0080.00017.87
8.2.10.0040.00418.08
8.2.00.0040.00417.73
8.1.280.0120.00925.92
8.1.270.0060.00322.32
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0050.00522.45
8.1.230.0040.00817.79
8.1.220.0030.00617.79
8.1.210.0000.00818.77
8.1.200.0040.00417.48
8.1.190.0040.00417.36
8.1.180.0080.00018.10
8.1.170.0090.00018.70
8.1.160.0040.00422.13
8.1.150.0040.00418.82
8.1.140.0000.00717.50
8.1.130.0050.00317.88
8.1.120.0080.00017.53
8.1.110.0000.00817.55
8.1.100.0040.00417.55
8.1.90.0050.00317.57
8.1.80.0050.00217.40
8.1.70.0070.00017.45
8.1.60.0040.00417.63
8.1.50.0040.00417.58
8.1.40.0000.00917.48
8.1.30.0080.00017.74
8.1.20.0040.00417.58
8.1.10.0040.00417.62
8.1.00.0040.00417.64
8.0.300.0080.00018.77
8.0.290.0050.00216.75
8.0.280.0030.00318.57
8.0.270.0070.00016.84
8.0.260.0030.00317.25
8.0.250.0070.00016.92
8.0.240.0040.00417.00
8.0.230.0000.00816.93
8.0.220.0080.00016.85
8.0.210.0040.00416.90
8.0.200.0000.00716.86
8.0.190.0050.00317.02
8.0.180.0000.00716.90
8.0.170.0000.00816.98
8.0.160.0080.00017.00
8.0.150.0000.00816.94
8.0.140.0080.00016.81
8.0.130.0000.00713.42
8.0.120.0060.00316.79
8.0.110.0040.00416.98
8.0.100.0000.00716.79
8.0.90.0050.00216.79
8.0.80.0120.00416.91
8.0.70.0070.00016.94
8.0.60.0040.00417.02
8.0.50.0040.00416.77
8.0.30.0110.01117.17
8.0.20.0150.01117.40
8.0.10.0000.00816.95
8.0.00.0040.01316.94
7.4.330.0050.00015.00
7.4.320.0000.00616.65
7.4.300.0060.00016.48
7.4.290.0000.00716.57
7.4.280.0000.00716.66
7.4.270.0000.00716.65
7.4.260.0000.00716.67
7.4.250.0040.00416.53
7.4.240.0040.00416.49
7.4.230.0070.00016.76
7.4.220.0090.00916.51
7.4.210.0070.01416.69
7.4.200.0000.00716.76
7.4.160.0060.01016.49
7.4.150.0160.00317.40
7.4.140.0100.00817.86
7.4.130.0050.01216.51
7.4.120.0120.00516.65
7.4.110.0080.00816.60
7.4.100.0120.00616.61
7.4.90.0110.00616.74
7.4.80.0130.00919.39
7.4.70.0110.00616.45
7.4.60.0060.01016.53
7.4.50.0030.00316.50
7.4.40.0120.01316.53
7.4.30.0090.00916.67
7.4.00.0090.00314.72
7.3.330.0030.00313.33
7.3.320.0050.00013.29
7.3.310.0040.00416.40
7.3.300.0020.00516.36
7.3.290.0090.00916.32
7.3.280.0100.00816.36
7.3.270.0160.00317.40
7.3.260.0090.00916.57
7.3.250.0070.00916.40
7.3.240.0040.01216.69
7.3.230.0030.01416.60
7.3.210.0070.01516.30
7.3.200.0170.00319.39
7.3.190.0110.01116.30
7.3.180.0130.00316.50
7.3.170.0030.01216.59
7.3.160.0140.00716.41
7.3.10.0060.00916.36
7.3.00.0060.00916.64
7.2.330.0130.01216.60
7.2.320.0130.00616.86
7.2.310.0090.01416.73
7.2.300.0030.01316.59
7.2.290.0060.00916.85
7.2.130.0000.01116.68
7.2.120.0120.00316.80
7.2.110.0040.00716.80
7.2.100.0110.00416.89
7.2.90.0050.00516.98
7.2.80.0030.01017.06
7.2.70.0000.01517.01
7.2.60.0070.01016.95
7.2.50.0080.00416.95
7.2.40.0030.00716.90
7.2.30.0040.00816.96
7.2.20.0040.00717.06
7.2.10.0030.01016.94
7.2.00.0050.00918.29
7.1.250.0030.00715.52
7.1.100.0000.01118.15
7.1.70.0000.00717.27
7.1.60.0160.00719.12
7.1.50.0070.01316.98
7.1.00.0070.07322.32
7.0.200.0040.00716.46
7.0.140.0100.07022.22
7.0.60.0100.07019.98
7.0.50.0030.08017.96
7.0.40.0100.08720.15
7.0.30.0270.07720.20
7.0.20.0430.04320.07
7.0.10.0300.05020.27
7.0.00.0070.08020.20
5.6.280.0030.07020.85
5.6.210.0070.03720.50
5.6.200.0070.04318.20
5.6.190.0070.08720.41
5.6.180.0200.08720.63
5.6.170.0170.05020.71
5.6.160.0000.06020.55
5.6.150.0000.04318.17
5.6.140.0070.05718.21
5.6.130.0130.03318.20
5.6.120.0070.08021.01
5.6.110.0070.07020.96
5.6.100.0100.07021.13
5.6.90.0030.08721.12
5.6.80.0100.07320.40
5.6.70.3900.03720.44
5.5.350.0070.08320.43
5.5.340.0130.08017.93
5.5.330.0100.06320.43
5.5.320.0370.08020.42
5.5.310.0200.06720.51
5.5.300.0030.04017.97
5.5.290.0070.06717.98
5.5.280.0030.07320.91
5.5.270.0100.05020.90
5.5.260.0030.06720.78
5.5.250.0000.04320.71
5.5.240.0130.06720.37
5.4.450.0370.05019.55
5.4.440.0270.04719.45
5.4.430.0130.04319.45
5.4.420.0630.03319.47
5.4.410.0370.03719.45
5.4.400.0170.04019.45
5.4.390.0470.05019.45
5.4.380.0370.05318.53
5.4.370.0230.06018.80
5.4.360.0370.04718.49
5.4.350.0470.04718.83
5.4.340.0330.06718.72
5.4.320.0110.03712.53
5.4.310.0090.03712.52
5.4.300.0040.04512.52
5.4.290.0060.04812.52
5.4.280.0080.03912.42
5.4.270.0100.03412.42
5.4.260.0040.05012.41
5.4.250.0060.04212.41
5.4.240.0100.03512.41
5.4.230.0050.04612.41
5.4.220.0080.04412.41
5.4.210.0060.04212.41
5.4.200.0060.03912.41
5.4.190.0070.03612.40
5.4.180.0060.04012.40
5.4.170.0060.05312.41
5.4.160.0080.04112.41
5.4.150.0060.03512.40
5.4.140.0060.03612.09
5.4.130.0050.03712.07
5.4.120.0040.03912.04
5.4.110.0080.04312.04
5.4.100.0090.03812.03
5.4.90.0070.04012.03
5.4.80.0100.04312.03
5.4.70.0100.03412.03
5.4.60.0060.03612.03
5.4.50.0040.03712.03
5.4.40.0050.04212.01
5.4.30.0080.03812.02
5.4.20.0070.04012.01
5.4.10.0060.03412.01
5.4.00.0050.03611.51
5.3.290.0100.03712.80
5.3.280.0100.04012.71
5.3.270.0080.04112.72
5.3.260.0040.04812.72
5.3.250.0070.04012.72
5.3.240.0040.04212.72
5.3.230.0070.03812.72
5.3.220.0090.03912.68
5.3.210.0030.04412.68
5.3.200.0070.03812.68
5.3.190.0110.03712.68
5.3.180.0070.03812.68
5.3.170.0070.04512.68
5.3.160.0060.04112.67
5.3.150.0080.04612.68
5.3.140.0090.04512.66
5.3.130.0090.04212.66
5.3.120.0070.03912.66
5.3.110.0080.04712.66
5.3.100.0050.03812.14
5.3.90.0080.04512.13
5.3.80.0080.03612.12
5.3.70.0090.04312.12
5.3.60.0080.03912.11
5.3.50.0070.04712.05
5.3.40.0070.03912.05
5.3.30.0080.04312.01
5.3.20.0040.04111.80
5.3.10.0040.03711.75
5.3.00.0060.03811.75
5.2.170.0020.0349.25
5.2.160.0070.0289.25
5.2.150.0050.0329.25
5.2.140.0110.0349.24
5.2.130.0040.0349.21
5.2.120.0060.0399.22
5.2.110.0070.0389.22
5.2.100.0070.0379.21
5.2.90.0060.0319.21
5.2.80.0120.0359.21
5.2.70.0090.0339.21
5.2.60.0100.0279.16
5.2.50.0050.0329.13
5.2.40.0060.0299.11
5.2.30.0030.0439.08
5.2.20.0060.0299.07
5.2.10.0050.0328.98
5.2.00.0080.0318.84
5.1.60.0040.0268.13
5.1.50.0040.0258.12
5.1.40.0040.0258.10
5.1.30.0050.0258.45
5.1.20.0040.0268.47
5.1.10.0050.0418.20
5.1.00.0040.0258.20
5.0.50.0020.0336.68
5.0.40.0040.0246.54
5.0.30.0040.0326.36
5.0.20.0050.0186.34
5.0.10.0020.0216.32
5.0.00.0020.0346.32
4.4.90.0020.0154.78
4.4.80.0010.0194.76
4.4.70.0030.0154.75
4.4.60.0010.0174.75
4.4.50.0030.0154.77
4.4.40.0050.0244.71
4.4.30.0020.0164.76
4.4.20.0020.0164.85
4.4.10.0020.0174.85
4.4.00.0030.0274.76
4.3.110.0050.0134.67
4.3.100.0020.0174.67
4.3.90.0040.0154.64
4.3.80.0020.0254.59
4.3.70.0010.0154.63
4.3.60.0030.0144.62
4.3.50.0010.0174.63
4.3.40.0030.0294.53
4.3.30.0040.0143.29
4.3.20.0040.0143.26
4.3.10.0030.0163.22
4.3.00.0030.01719.45

preferences:
46.72 ms | 401 KiB | 5 Q