3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Region { protected $city; protected $country; protected $cityCode; protected $countryCode; /** * @return mixed */ public function getCity() { return $this->city; } /** * @param mixed $city */ public function setCity($city) { $this->city = $city; } /** * @return mixed */ public function getCountry() { return $this->country; } /** * @param mixed $country */ public function setCountry($country) { $this->country = $country; } /** * @return mixed */ public function getCityCode() { return $this->cityCode; } /** * @param mixed $cityCode */ public function setCityCode($cityCode) { $this->cityCode = $cityCode; } /** * @return mixed */ public function getCountryCode() { return $this->countryCode; } /** * @param mixed $countryCode */ public function setCountryCode($countryCode) { $this->countryCode = $countryCode; } } $time = microtime(true); $memory = memory_get_usage(true); $collection = []; $randSrtring = hash_hmac('md5',rand(0, 1000), 'some key'); for ($i = 0; $i <= 100000; $i++) { $region = []; $region['city'] = $randSrtring; $region['city_code'] = $randSrtring; $region['country'] = $randSrtring; $region['country_code'] = $randSrtring; array_push($collection, $region); } $resultTime = @(microtime(true) - $time); $resultMemory = @round((memory_get_usage(true) - $memory) / (1024 * 1024)); echo sprintf( "Time: %s, Memory: %sMB", $resultTime, $resultMemory );

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)
7.3.10.1120.03856.68
7.3.00.0990.02656.70
7.2.130.0710.03756.94
7.2.120.0370.05757.17
7.2.110.0720.03457.11
7.2.100.0890.03057.15
7.2.90.1020.04057.12
7.2.80.1010.04357.09
7.2.70.1430.03456.63
7.2.60.1230.04156.97
7.2.50.1280.04456.95
7.2.40.1540.04057.17
7.2.30.1580.03756.94
7.2.20.1270.04056.86
7.2.10.1340.02557.12
7.2.00.1460.04156.94
7.1.250.0950.05856.01
7.1.70.0110.02557.50
7.1.60.0170.03157.77
7.1.50.2470.04072.48
7.1.40.4400.06371.91
7.1.30.2100.05372.19
7.1.20.2600.07371.70
7.1.10.2970.05354.15
7.1.00.4070.05354.35
7.0.200.0130.06057.01
7.0.190.5630.05353.96
7.0.180.0830.04753.67
7.0.170.4670.06053.82
7.0.160.1000.05053.59
7.0.150.2770.04754.00
7.0.140.1100.06353.96
7.0.130.3300.07053.63
7.0.120.0900.05353.98
7.0.110.1400.05353.67
7.0.100.5030.07753.67
7.0.90.3530.07053.92
7.0.80.6030.04753.69
7.0.70.0570.06353.55
7.0.60.0800.04753.21
7.0.50.3530.09053.49
7.0.40.0930.06753.89
7.0.30.0970.06353.87
7.0.20.5430.06753.78
7.0.10.5400.07354.11
7.0.00.4230.05353.88

preferences:
36.23 ms | 400 KiB | 5 Q