3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Manufacturer{ protected $_name; public function setManufacturerName($name){ $this->_name = $name; } public function getManufacturerName(){ return $this->_name; } } class Product{ protected $_title; protected $_category; protected $_manufacturer; public function __construct(){ $this->_manufacturer = new Manufacturer(); } public function getCategory(){ return $this->_category; } public function getTitle(){ return $this->_title; } public function setManufacturerName($name){ $this->_manufacturer->setManufacturerName($name); } /*public function __clone(){ $this->_manufacturer = clone $this->_manufacturer; } // with use of this magic method __clone() it will echo: CD Brahms is made by Producent A */ public function getManufacturerName(){ return $this->_manufacturer->getManufacturerName(); } } class Order extends Product{ protected $_price; protected $_deliver; public function __construct($title, $category, $price){ parent::__construct(); $this->_title = $title; $this->_category = $category; $this->_price = $price; $this->doWeDeliver(); } public function setTitle($title){ $this->_title = $title; } public function getPrice(){ return $this->_price; } public function getDeliver(){ return $this->_deliver; } protected function doWeDeliver(){ $this->_deliver = $this->_price > 30 ? "Yes" : "No" ; } public function displaySentence(){ echo "Product: ".$this->_title." Category: ".$this->_category." Prijs: ".$this->_price." Gratis bezorging: ".$this->_deliver; } } $order = new Order("CD Brahms", "Media", "45"); $order->setManufacturerName("Producent A"); echo $order->getTitle()." is made by ". $order->getManufacturerName()."<br />"; // CD Brahms is made by Producent A $order2 = clone $order; $order2->setTitle("Second title"); $order2->setManufacturerName("Producent B"); echo $order2->getTitle()." is made by ". $order2->getManufacturerName()."<br />"; // Second title is made by Producent B echo $order->getTitle()." is made by ". $order->getManufacturerName()."<br />"; // CD Brahms is made by Producent B CD Brahms is made by Producent A with use of __clone()

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.00418.43
8.3.50.0110.00817.42
8.3.40.0070.00718.89
8.3.30.0040.01218.67
8.3.20.0040.00418.77
8.3.10.0090.00020.35
8.3.00.0000.00817.34
8.2.180.0090.00916.88
8.2.170.0150.00022.96
8.2.160.0070.00721.98
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00019.83
8.2.110.0060.00621.06
8.2.100.0040.00817.91
8.2.90.0000.00719.22
8.2.80.0060.00317.97
8.2.70.0050.00317.63
8.2.60.0050.00317.93
8.2.50.0090.00018.07
8.2.40.0000.00818.16
8.2.30.0030.00618.22
8.2.20.0020.00517.75
8.2.10.0030.00517.75
8.2.00.0080.00017.78
8.1.280.0110.00425.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0090.00022.42
8.1.230.0080.00320.90
8.1.220.0000.00818.77
8.1.210.0000.00818.96
8.1.200.0030.00617.35
8.1.190.0030.00717.52
8.1.180.0050.00518.10
8.1.170.0050.00318.91
8.1.160.0000.00818.84
8.1.150.0000.00718.59
8.1.140.0060.00317.37
8.1.130.0000.00717.90
8.1.120.0000.00717.43
8.1.110.0050.00317.31
8.1.100.0030.00517.38
8.1.90.0070.00317.23
8.1.80.0030.00417.41
8.1.70.0030.00317.36
8.1.60.0000.00817.64
8.1.50.0080.00017.41
8.1.40.0030.00517.61
8.1.30.0040.00417.70
8.1.20.0030.00517.70
8.1.10.0000.00717.52
8.1.00.0080.00017.41
8.0.300.0000.00720.10
8.0.290.0000.01016.75
8.0.280.0000.00718.41
8.0.270.0030.00517.30
8.0.260.0030.00318.61
8.0.250.0080.00017.00
8.0.240.0000.00817.09
8.0.230.0040.00416.93
8.0.220.0000.00716.95
8.0.210.0000.00716.84
8.0.200.0030.00317.03
8.0.190.0040.00417.00
8.0.180.0050.00316.86
8.0.170.0000.01016.96
8.0.160.0080.00016.94
8.0.150.0000.00816.89
8.0.140.0120.00016.79
8.0.130.0000.00613.34
8.0.120.0040.00416.86
8.0.110.0000.00816.80
8.0.100.0000.00716.95
8.0.90.0080.00017.00
8.0.80.0120.00616.98
8.0.70.0000.00816.94
8.0.60.0040.00416.97
8.0.50.0040.00416.98
8.0.30.0160.00617.04
8.0.20.0120.00717.15
8.0.10.0030.00517.00
8.0.00.0090.00916.72
7.4.330.0000.00514.84
7.4.320.0070.00016.56
7.4.300.0000.00616.47
7.4.290.0050.00216.64
7.4.280.0060.00316.55
7.4.270.0030.00316.64
7.4.260.0030.00313.31
7.4.250.0040.00416.54
7.4.240.0000.00816.69
7.4.230.0000.00716.43
7.4.220.0130.00916.54
7.4.210.0070.00716.64
7.4.200.0000.00716.73
7.4.190.0000.00716.68
7.4.160.0120.00316.33
7.4.150.0090.00917.07
7.4.140.0070.01117.20
7.4.130.0090.00916.42
7.4.120.0110.00816.66
7.4.110.0030.01316.56
7.4.100.0110.01116.46
7.4.90.0060.01216.66
7.4.80.0170.00018.80
7.4.70.0070.01116.55
7.4.60.0100.00716.46
7.4.50.0000.00716.41
7.4.40.0090.00922.27
7.4.30.0030.01416.63
7.4.00.0070.01114.91
7.3.330.0000.00713.15
7.3.320.0000.00613.14
7.3.310.0030.00316.22
7.3.300.0000.00716.30
7.3.290.0090.01016.30
7.3.280.0110.00616.33
7.3.270.0110.00717.07
7.3.260.0070.01118.24
7.3.250.0080.01316.41
7.3.240.0130.00616.42
7.3.230.0130.00316.59
7.3.210.0000.01816.23
7.3.200.0060.01219.39
7.3.190.0160.00616.29
7.3.180.0090.00616.29
7.3.170.0090.00916.32
7.3.160.0040.01716.52
7.3.120.0050.01014.86
7.3.110.0070.01014.85
7.3.100.0070.01014.75
7.3.90.0130.00314.78
7.3.80.0060.00614.53
7.3.70.0070.00714.93
7.3.60.0070.01114.69
7.3.50.0100.00914.65
7.3.40.0030.01314.82
7.3.30.0060.00614.86
7.3.20.0170.00316.80
7.3.10.0090.00616.59
7.3.00.0080.00516.42
7.2.330.0090.01216.63
7.2.320.0140.00916.84
7.2.310.0120.00616.62
7.2.300.0100.01016.89
7.2.290.0070.01016.89
7.2.250.0060.01215.38
7.2.240.0120.00614.94
7.2.230.0030.01315.22
7.2.220.0040.00814.84
7.2.210.0040.01114.93
7.2.200.0040.01114.91
7.2.190.0060.01015.05
7.2.180.0060.00815.07
7.2.170.0060.01015.00
7.2.60.0060.00316.85
7.2.00.0040.01119.62
7.1.330.0040.01215.82
7.1.320.0040.01215.94
7.1.310.0100.00315.92
7.1.300.0060.01215.77
7.1.290.0060.00615.82
7.1.280.0060.00915.77
7.1.270.0100.00715.97
7.1.260.0040.01115.62
7.1.200.0040.00815.63
7.1.100.0000.01118.20
7.1.70.0060.00617.18
7.1.60.0000.02419.40
7.1.50.0070.01416.96
7.1.00.0000.07722.30
7.0.200.0050.00216.74
7.0.140.0030.07322.08
7.0.60.0130.06320.07
7.0.50.0070.08317.91
7.0.40.0030.06020.13
7.0.30.0530.07320.25
7.0.20.0270.07720.19
7.0.10.0230.06020.21
7.0.00.0130.07020.25
5.6.280.0100.06721.12
5.6.210.0100.05020.71
5.6.200.0030.05318.29
5.6.190.0100.06020.57
5.6.180.0030.08320.54
5.6.170.0370.07720.58
5.6.160.0100.08020.55
5.6.150.0070.08318.17
5.6.140.0100.04718.17
5.6.130.0030.04018.16
5.6.120.0000.09321.02
5.6.110.0170.04721.11
5.6.100.0030.09021.03
5.6.90.0070.08020.95
5.6.80.0070.08320.43
5.6.70.3800.03320.37
5.5.350.0270.07720.43
5.5.340.0070.08018.07
5.5.330.0070.08320.30
5.5.320.0300.03320.51
5.5.310.0330.07720.32
5.5.300.0030.04018.04
5.5.290.0130.07317.98
5.5.280.0070.05020.76
5.5.270.0130.08320.88
5.5.260.0170.07320.79
5.5.250.0100.07020.80
5.5.240.0130.06020.14
5.4.450.0200.07319.64
5.4.440.3870.04019.55
5.4.430.0130.05319.61
5.4.420.0170.07319.46
5.4.410.0170.06019.44
5.4.400.0100.06319.14
5.4.390.0070.05319.16
5.4.380.0330.04318.61
5.4.370.0070.03718.72
5.4.360.0100.03318.88
5.4.350.0060.03712.04
5.4.340.0090.03912.03
5.4.320.0060.03712.53
5.4.310.0030.04012.52
5.4.300.0070.05012.52
5.4.290.0090.05312.51
5.4.280.0130.05112.41
5.4.270.0080.05212.41
5.4.260.0090.04412.41
5.4.250.0080.04512.42
5.4.240.0050.04612.41
5.4.230.0080.04912.41
5.4.220.0110.04412.41
5.4.210.0100.04312.41
5.4.200.0110.04212.41
5.4.190.0100.04212.41
5.4.180.0060.04712.40
5.4.170.0090.04212.41
5.4.160.0080.04512.41
5.4.150.0090.05012.40
5.4.140.0110.05112.09
5.4.130.0130.05712.08
5.4.120.0090.05112.04
5.4.110.0070.04812.03
5.4.100.0060.04812.03
5.4.90.0110.05112.03
5.4.80.0090.04712.03
5.4.70.0090.06312.03
5.4.60.0130.06412.03
5.4.50.0110.06312.03
5.4.40.0130.07412.01
5.4.30.0130.07312.02
5.4.20.0090.05912.02
5.4.10.0070.05012.01
5.4.00.0090.06411.50
5.3.290.0050.04112.80
5.3.280.0120.05912.71
5.3.270.0090.06112.72
5.3.260.0110.06212.72
5.3.250.0050.04712.72
5.3.240.0080.05712.72
5.3.230.0090.05312.71
5.3.220.0140.07812.68
5.3.210.0150.06612.68
5.3.200.0090.06312.68
5.3.190.0120.05612.68
5.3.180.0080.05012.67
5.3.170.0090.05512.67
5.3.160.0120.05912.67
5.3.150.0090.05412.68
5.3.140.0110.05512.66
5.3.130.0110.05512.66
5.3.120.0080.04512.66
5.3.110.0060.04712.66
5.3.100.0070.04812.14
5.3.90.0090.04412.12
5.3.80.0060.04012.11
5.3.70.0080.04012.11

preferences:
42.18 ms | 401 KiB | 5 Q