3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function insertObject($table, &$object, $key = null) { $fields = array(); $values = array(); // Iterate over the object variables to build the query fields and values. foreach (get_object_vars($object) as $k => $v) { // Only process non-null scalars. if (is_array($v) or is_object($v) or $v === null) { continue; } // Ignore any internal fields. if ($k[0] == '_') { continue; } // Prepare and sanitize the fields and values for the database query. $fields[] = $this->quoteName($k); $values[] = $this->quote($v); } // Create the base insert statement. $query = $this->getQuery(true) ->insert($this->quoteName($table)) ->columns($fields) ->values(implode(',', $values)); // Set the query and execute the insert. $this->setQuery($query); if (!$this->execute()) { return false; } // Update the primary key if it exists. $id = $this->insertid(); if ($key && $id && is_string($key)) { $object->$key = $id; } return true; }

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)
5.4.270.0130.04718.94
5.4.260.0100.04718.77
5.4.250.0100.04719.09
5.4.240.0000.05718.95
5.4.230.0100.04718.96
5.4.220.0000.06018.90
5.4.210.0070.05018.76
5.4.200.0070.05018.90
5.4.190.0170.06018.89
5.4.180.0130.04718.99
5.4.170.0130.05018.95
5.4.160.0100.05018.75
5.4.150.0030.06018.92
5.4.140.0130.04316.43
5.4.130.0130.04016.39
5.4.120.0070.04716.54
5.4.110.0030.05316.41
5.4.100.0100.04716.55
5.4.90.0130.04716.41
5.4.80.0130.04016.64
5.4.70.0100.04316.63
5.4.60.0130.04016.34
5.4.50.0100.04716.45
5.4.40.0100.04316.54
5.4.30.0170.06016.52
5.4.20.0030.05016.30
5.4.10.0030.05316.48
5.4.00.0130.04715.83
5.3.280.0130.04314.69
5.3.270.0070.07014.70
5.3.260.0070.05314.38
5.3.250.0070.05014.75
5.3.240.0100.04714.38
5.3.230.0070.04714.44
5.3.220.0100.05314.48
5.3.210.0100.04714.45
5.3.200.0100.06314.46
5.3.190.0130.04714.46
5.3.180.0170.04314.48
5.3.170.0130.04014.57
5.3.160.0100.04714.60
5.3.150.0070.05014.45
5.3.140.0030.05014.47
5.3.130.0070.07314.41
5.3.120.0100.04714.25
5.3.110.0170.04314.56
5.3.100.0070.04713.81
5.3.90.0100.04314.03
5.3.80.0100.07014.11
5.3.70.0170.04014.01
5.3.60.0100.04713.95
5.3.50.0030.05013.89
5.3.40.0130.04313.96
5.3.30.0000.05313.85
5.3.20.0100.04313.39
5.3.10.0070.04713.36
5.3.00.0070.05013.52
5.2.170.0070.04011.23
5.2.160.0100.03311.29
5.2.150.0000.04310.97
5.2.140.0070.04011.02
5.2.130.0100.03311.01
5.2.120.0100.03310.86
5.2.110.0000.04711.03
5.2.100.0100.03711.20
5.2.90.0100.05311.02
5.2.80.0070.05710.92
5.2.70.0070.04011.20
5.2.60.0000.05311.05
5.2.50.0030.04011.17
5.2.40.0030.04011.02
5.2.30.0030.06010.98
5.2.20.0100.03310.98
5.2.10.0030.04011.03
5.2.00.0030.04310.94
5.1.60.0070.0479.95
5.1.50.0030.0339.90
5.1.40.0030.03710.02
5.1.30.0070.03310.39
5.1.20.0070.03310.44
5.1.10.0070.0379.83
5.1.00.0000.03710.15
5.0.50.0030.0308.60
5.0.40.0030.0338.64
5.0.30.0070.0408.26
5.0.20.0030.0278.27
5.0.10.0100.0208.00
5.0.00.0030.0408.39
4.4.90.0000.0237.24
4.4.80.0030.0207.24
4.4.70.0000.0237.24
4.4.60.0000.0307.24
4.4.50.0100.0137.25
4.4.40.0030.0377.25
4.4.30.0070.0207.25
4.4.20.0100.0137.25
4.4.10.0030.0277.25
4.4.00.0070.0307.25
4.3.110.0070.0177.25
4.3.100.0030.0307.25
4.3.90.0070.0137.25
4.3.80.0000.0337.25
4.3.70.0000.0207.25
4.3.60.0070.0177.25
4.3.50.0030.0207.25
4.3.40.0030.0307.25
4.3.30.0070.0177.25
4.3.20.0100.0137.25
4.3.10.0000.0207.25
4.3.00.0000.0236.70

preferences:
146.37 ms | 1394 KiB | 7 Q