3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Cookpedia; class Entry { private $hydrated = false; private $data = [ 'id' => 0, 'title' => null, 'latin_title' => null, 'category' => 0, 'calories' => 0, 'proteins' => 0, 'fats' => 0, 'carbohydrates' => 0, 'description' => null, 'tags' => null, 'measures' => [], ]; public function hydrate(PDO $dbh, int $id): void { $stmt = $dbh->prepare("SELECT `title`, `latin_title`, `category`, `calories`, `proteins`, `fats`, `carbohydrates`, `description`, `measures`, `tags` FROM `cook_encyclopedia_entries` WHERE `id`=:id"); $result = $stmt->execute($id); $this->data = $result->fetch(PDO::FETCH_ASSOC); $this->data['measures'] = $this->computeMeasures($this->data['measures']); $this->hydrated = true; } public function getData(): array { if (!$this->hydrated) { throw new \Exception('hydrate first'); } return $this->data; } private function computeMeasures(string $measures): array { $measureArray = explode('|', $measures); return [ 'g_in_tsp' => $measureArray[0], 'g_in_tbsp' => $measureArray[1], 'g_in_glass' => $measureArray[2], 'g_in_cup' => $measureArray[3], ]; } }

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.0110.00418.43
8.3.50.0100.00718.10
8.3.40.0130.00618.57
8.3.30.0120.00418.66
8.3.20.0070.00021.77
8.3.10.0080.00018.84
8.3.00.0000.00821.73
8.2.180.0100.00718.16
8.2.170.0080.00822.96
8.2.160.0030.01022.08
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00421.07
8.2.110.0030.00721.00
8.2.100.0070.00419.47
8.2.90.0000.00817.72
8.2.80.0040.00417.97
8.2.70.0000.01117.80
8.2.60.0040.00417.97
8.2.50.0060.00319.38
8.2.40.0050.00220.48
8.2.30.0040.00420.56
8.2.20.0050.00217.93
8.2.10.0040.00418.82
8.2.00.0030.00519.75
8.1.280.0120.00625.92
8.1.270.0040.00420.71
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0140.00721.91
8.1.230.0060.00920.90
8.1.220.0090.00017.74
8.1.210.0050.00318.77
8.1.200.0090.00017.10
8.1.190.0050.00317.11
8.1.180.0040.00418.10
8.1.170.0030.00518.39
8.1.160.0050.00318.84
8.1.150.0040.00418.72
8.1.140.0040.00420.27
8.1.130.0030.00320.31
8.1.120.0040.00417.36
8.1.110.0030.00517.36
8.1.100.0000.00817.32
8.1.90.0040.00417.27
8.1.80.0050.00317.24
8.1.70.0090.00017.33
8.1.60.0040.00417.45
8.1.50.0000.00817.30
8.1.40.0040.00417.41
8.1.30.0040.00417.61
8.1.20.0040.00417.55
8.1.10.0030.00517.45
8.1.00.0050.00317.38
8.0.300.0000.00719.73
8.0.290.0030.00716.58
8.0.280.0040.00418.24
8.0.270.0070.00017.15
8.0.260.0060.00318.29
8.0.250.0030.00316.86
8.0.240.0030.00316.76
8.0.230.0070.00016.86
8.0.220.0080.00016.76
8.0.210.0000.00816.75
8.0.200.0060.00016.76
8.0.190.0040.00416.77
8.0.180.0000.00716.80
8.0.170.0060.00316.81
8.0.160.0040.00416.72
8.0.150.0000.00816.71
8.0.140.0000.00716.64
8.0.130.0050.00013.09
8.0.120.0000.00816.79
8.0.110.0000.00816.60
8.0.100.0050.00216.67
8.0.90.0040.00416.65
8.0.80.0080.00816.70
8.0.70.0030.00516.72
8.0.60.0050.00316.66
8.0.50.0000.00716.80
8.0.30.0090.00916.94
8.0.20.0070.01317.18
8.0.10.0040.00416.89
8.0.00.0110.01216.68
7.4.330.0050.00015.55
7.4.320.0030.00616.50
7.4.300.0000.00616.53
7.4.290.0080.00016.50
7.4.280.0000.00816.48
7.4.270.0030.00316.35
7.4.260.0050.00216.45
7.4.250.0070.00016.42
7.4.240.0000.00716.54
7.4.230.0080.00016.33
7.4.220.0040.00416.52
7.4.210.0060.00916.37
7.4.200.0030.00316.33
7.4.160.0100.01016.35
7.4.140.0110.00617.86
7.4.130.0080.00816.41
7.4.120.0100.00716.58
7.4.110.0090.00916.27
7.4.100.0100.00716.31
7.4.90.0100.00716.48
7.4.80.0090.01119.39
7.4.70.0050.01016.22
7.4.60.0040.01216.30
7.4.50.0070.00716.28
7.4.40.0030.01316.47
7.4.10.0080.00716.34
7.4.00.0100.00715.21
7.3.330.0050.00013.01
7.3.320.0050.00013.05
7.3.310.0070.00016.18
7.3.300.0030.00316.18
7.3.290.0070.00716.10
7.3.280.0100.00816.18
7.3.260.0080.01316.31
7.3.240.0090.00916.21
7.3.230.0100.00616.18
7.3.210.0100.01016.13
7.3.200.0030.01416.22
7.3.190.0170.00316.16
7.3.180.0090.01216.45
7.3.170.0060.01016.15
7.3.160.0130.00316.32
7.3.130.0090.00916.33
7.3.120.0130.00615.51
7.3.110.0050.01315.36
7.3.100.0110.00715.58
7.3.90.0040.01115.56
7.3.80.0030.00815.54
7.3.70.0080.00815.30
7.3.60.0090.00515.48
7.3.50.0060.00615.17
7.3.40.0070.00415.11
7.3.30.0070.00914.99
7.3.20.0110.00716.35
7.3.10.0050.01016.26
7.3.00.0040.00616.39
7.2.330.0130.01016.41
7.2.320.0090.01416.44
7.2.310.0060.01016.46
7.2.300.0080.00816.50
7.2.290.0070.01116.47
7.2.260.0070.01116.56
7.2.250.0060.01315.66
7.2.240.0080.00815.71
7.2.230.0070.00815.61
7.2.220.0050.00915.63
7.2.210.0070.00715.57
7.2.200.0090.00615.67
7.2.190.0100.00415.62
7.2.180.0070.00415.28
7.2.170.0090.00515.34
7.2.160.0060.00715.31
7.2.150.0070.00816.59
7.2.140.0080.00616.66
7.2.130.0040.01116.54
7.2.120.0060.01016.49
7.2.110.0090.00716.62
7.2.100.0090.01116.63
7.2.90.0080.00616.61
7.2.80.0080.00616.58
7.2.70.0060.00916.70
7.2.60.0080.00816.53
7.2.50.0110.00616.57
7.2.40.0140.00616.68
7.2.30.0100.00916.62
7.2.20.0060.01116.57
7.2.10.0020.01216.57
7.2.00.0060.00816.66
7.1.330.0020.01616.35
7.1.320.0050.00916.29
7.1.310.0050.01116.45
7.1.300.0040.01116.30
7.1.290.0080.00116.39
7.1.280.0060.00815.45
7.1.270.0100.00915.46
7.1.260.0100.00415.38
7.1.250.0070.00915.62
7.1.240.0080.00516.33
7.1.230.0020.01016.45
7.1.220.0060.00916.29
7.1.210.0070.00916.31
7.1.200.0070.00516.36
7.1.190.0050.00716.28
7.1.180.0020.01016.22
7.1.170.0030.01016.29
7.1.160.0050.01016.26
7.1.150.0050.00516.41
7.1.140.0070.00616.34
7.1.130.0060.00716.24
7.1.120.0070.00416.33
7.1.110.0050.00716.49
7.1.100.0070.00516.54
7.1.90.0110.00416.47
7.1.80.0100.00716.24
7.1.70.0070.00616.45
7.1.60.0100.00816.49
7.1.50.0050.00816.46
7.1.40.0030.01216.49
7.1.30.0030.01216.21
7.1.20.0050.01116.41
7.1.10.0050.00716.29
7.1.00.0110.00116.17

preferences:
57.5 ms | 401 KiB | 5 Q