3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Drupal\Core\Database; interface StatementInterface extends \Traversable { //protected function __construct(Connection $dbh); public function execute($args = array(), $options = array()); public function getQueryString(); public function rowCount(); public function setFetchMode($mode, $a1 = NULL, $a2 = array()); public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL); public function fetchField($index = 0); public function fetchObject(); public function fetchAssoc(); public function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL); public function fetchCol($index = 0); public function fetchAllKeyed($key_index = 0, $value_index = 1); public function fetchAllAssoc($key, $fetch = NULL); } class Statement extends \PDOStatement implements StatementInterface { public $dbh; public $allowRowCount = FALSE; protected function __construct(Connection $dbh) { $this->dbh = $dbh; $this->setFetchMode(\PDO::FETCH_OBJ); } public function execute($args = array(), $options = array()) { if (isset($options['fetch'])) { if (is_string($options['fetch'])) { // \PDO::FETCH_PROPS_LATE tells __construct() to run before properties // are added to the object. $this->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, $options['fetch']); } else { $this->setFetchMode($options['fetch']); } } $logger = $this->dbh->getLogger(); if (!empty($logger)) { $query_start = microtime(TRUE); } $return = parent::execute($args); if (!empty($logger)) { $query_end = microtime(TRUE); $logger->log($this, $args, $query_end - $query_start); } return $return; } public function getQueryString() { return $this->queryString; } public function fetchCol($index = 0) { return $this->fetchAll(\PDO::FETCH_COLUMN, $index); } public function fetchAllAssoc($key, $fetch = NULL) { $return = array(); if (isset($fetch)) { if (is_string($fetch)) { $this->setFetchMode(\PDO::FETCH_CLASS, $fetch); } else { $this->setFetchMode($fetch); } } foreach ($this as $record) { $record_key = is_object($record) ? $record->$key : $record[$key]; $return[$record_key] = $record; } return $return; } public function fetchAllKeyed($key_index = 0, $value_index = 1) { $return = array(); $this->setFetchMode(\PDO::FETCH_NUM); foreach ($this as $record) { $return[$record[$key_index]] = $record[$value_index]; } return $return; } public function fetchField($index = 0) { // Call \PDOStatement::fetchColumn to fetch the field. return $this->fetchColumn($index); } public function fetchAssoc() { // Call \PDOStatement::fetch to fetch the row. return $this->fetch(\PDO::FETCH_ASSOC); } /** * {@inheritdoc} */ public function rowCount() { // SELECT query should not use the method. if ($this->allowRowCount) { return parent::rowCount(); } else { throw new RowCountException(); } } /** * {@inheritdoc} */ public function setFetchMode($mode, $a1 = NULL, $a2 = array()) { parent::setFetchMode($mode); } /** * {@inheritdoc} */ public function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL) { parent::fetchAll($mode, $column_index, $constructor_arguments); } } class Connection {}

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.0.110.0050.00316.88
8.0.100.0040.00416.96
8.0.90.0020.00516.97
8.0.80.0120.00316.96
8.0.70.0040.00416.99
8.0.60.0060.00316.94
8.0.50.0040.00417.07
8.0.30.0120.01017.05
8.0.20.0130.00817.40
8.0.10.0050.00316.93
8.0.00.0110.01116.71
7.4.240.0020.00516.56
7.4.230.0040.00416.67
7.4.220.0140.00416.45
7.4.210.0120.00316.60
7.4.200.0040.00416.68
7.4.160.0100.00616.62
7.4.150.0140.00917.40
7.4.140.0070.01417.86
7.4.130.0160.00516.51
7.4.120.0120.00916.42
7.4.110.0030.01416.53
7.4.100.0140.01016.43
7.4.90.0060.00916.54
7.4.80.0100.00619.39
7.4.70.0140.00716.63
7.4.60.0030.01616.39
7.4.50.0050.00016.25
7.4.40.0110.00616.25
7.4.30.0140.00316.47
7.4.00.0030.01014.92
7.3.300.0030.00316.17
7.3.290.0070.00816.25
7.3.280.0040.01316.30
7.3.270.0090.00917.40
7.3.260.0130.00416.28
7.3.250.0090.00816.48
7.3.240.0030.01616.32
7.3.230.0030.01516.39
7.3.210.0030.01416.50
7.3.200.0070.01019.39
7.3.190.0140.00316.44
7.3.180.0130.00316.56
7.3.170.0130.00916.48
7.3.160.0030.01316.32
7.2.330.0060.01216.36
7.2.320.0080.01116.66
7.2.310.0060.01116.36
7.2.300.0130.00316.56
7.2.290.0120.00616.24
7.2.60.0000.01116.69
7.2.00.0000.01219.08
7.1.200.0100.00615.54
7.1.100.0290.00317.50
7.1.70.0000.00716.96
7.1.60.0170.00719.48
7.1.50.0100.01016.98
7.1.00.0000.08022.32
7.0.200.0090.00016.61
7.0.60.0070.03720.02
7.0.50.0100.07717.78
7.0.40.0070.07320.02
7.0.30.0270.04020.17
7.0.20.0230.04320.10
7.0.10.0030.06320.21
7.0.00.0070.07720.23
5.6.280.0100.06720.95
5.6.210.0030.08320.70
5.6.200.0030.08718.23
5.6.190.0100.05320.58
5.6.180.0300.07320.39
5.6.170.0370.07020.71
5.6.160.0030.08720.38
5.6.150.0000.06018.30
5.6.140.0100.07718.20
5.6.130.0000.05718.24
5.6.120.0070.04320.99
5.6.110.0000.04721.00
5.6.100.0130.07020.99
5.6.90.0000.04321.15
5.6.80.0070.08320.37
5.5.350.0170.07020.53
5.5.340.0030.08717.99
5.5.330.0100.07320.56
5.5.320.0030.04720.56
5.5.310.0270.03320.34
5.5.300.0030.08317.97
5.5.290.0130.07318.06
5.5.280.0070.06020.84
5.5.270.0130.07720.77
5.5.260.0070.08320.77
5.5.250.0100.08720.55
5.5.240.0030.03020.19
5.4.450.0670.03719.20
5.4.440.0670.06019.48
5.4.430.0670.04719.42
5.4.420.0130.05719.68
5.4.410.0070.06019.52
5.4.400.0130.05019.12
5.4.390.0130.05019.13
5.4.380.0030.06319.16
5.4.370.0170.05018.98
5.4.360.0100.05019.06
5.4.350.0070.07719.00
5.4.340.0070.06719.12
5.4.320.0070.05719.25
5.4.310.0070.06019.11
5.4.300.0100.05319.19
5.4.290.0170.04319.04
5.4.280.0100.05019.03
5.4.270.0030.06019.08
5.4.260.0100.05319.13
5.4.250.0130.05319.21
5.4.240.0070.06019.05
5.4.230.0130.05019.05
5.4.220.0130.05319.10
5.4.210.0170.04719.01
5.4.200.0030.05716.73
5.4.190.0170.04719.04
5.4.180.0100.05319.06
5.4.170.0170.05019.05
5.4.160.0100.05319.14
5.4.150.0130.05019.00
5.4.140.0100.05016.49
5.4.130.0200.04716.68
5.4.120.0030.05316.31
5.4.110.0130.04316.59
5.4.100.0100.05016.52
5.4.90.0130.04716.63
5.4.80.0030.05316.50
5.4.70.0030.05316.37
5.4.60.0030.05316.61
5.4.50.0070.05016.25
5.4.40.0000.06016.47
5.4.30.0000.05316.46
5.4.20.0170.04016.46
5.4.10.0100.05016.34
5.4.00.0030.05716.02
5.3.290.0170.06714.90
5.3.280.0100.07314.82
5.3.270.0200.04714.63
5.3.260.0170.04714.63
5.3.250.0070.05314.88
5.3.240.0100.05014.63
5.3.230.0200.04314.63
5.3.220.0030.05314.79
5.3.210.0170.04714.60
5.3.200.0170.04314.82
5.3.190.0000.06014.58
5.3.180.0000.06014.80
5.3.170.0070.07314.72
5.3.160.0200.06014.84
5.3.150.0130.04714.68
5.3.140.0100.05014.58
5.3.130.0000.06314.84
5.3.120.0070.08014.66
5.3.110.0200.06314.59
5.3.100.0100.06014.10
5.3.90.0100.05014.26
5.3.80.0100.05014.10
5.3.70.0130.04714.12
5.3.60.0100.05014.28
5.3.50.0070.05314.07
5.3.40.0030.05314.07
5.3.30.0100.04713.89
5.3.20.0130.04713.71
5.3.10.0130.04313.67
5.3.00.0130.05013.68
5.2.170.0100.04010.93
5.2.160.0070.04011.23
5.2.150.0100.04011.14
5.2.140.0030.05010.99
5.2.130.0070.03711.03
5.2.120.0030.04011.00
5.2.110.0030.04311.11
5.2.100.0070.03711.11
5.2.90.0100.03710.96
5.2.80.0070.04010.94
5.2.70.0070.04011.18
5.2.60.0070.04011.09
5.2.50.0100.03710.88
5.2.40.0030.04010.89
5.2.30.0030.04310.89
5.2.20.0070.04011.04
5.2.10.0000.04310.93
5.2.00.0100.03710.70
5.1.60.0070.0339.83
5.1.50.0070.0339.92
5.1.40.0030.0339.91
5.1.30.0000.04010.29
5.1.20.0070.03310.43
5.1.10.0030.03710.06
5.1.00.0070.0339.98
5.0.50.0070.0278.54
5.0.40.0070.0278.49
5.0.30.0070.0438.16
5.0.20.0070.0278.04
5.0.10.0030.0308.09
5.0.00.0070.0408.08
4.4.90.0000.0275.76
4.4.80.0070.0175.77
4.4.70.0030.0305.75
4.4.60.0000.0375.74
4.4.50.0000.0335.78
4.4.40.0030.0375.75
4.4.30.0100.0175.79
4.4.20.0030.0235.83
4.4.10.0030.0205.94
4.4.00.0070.0305.80
4.3.110.0000.0235.67
4.3.100.0000.0235.67
4.3.90.0000.0235.66
4.3.80.0070.0335.65
4.3.70.0000.0235.66
4.3.60.0000.0235.64
4.3.50.0070.0205.73
4.3.40.0000.0375.69
4.3.30.0000.0234.43
4.3.20.0030.0204.51
4.3.10.0030.0234.38
4.3.00.0130.01315.37

preferences:
40.43 ms | 401 KiB | 5 Q