3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function updateRecord($table, $fields) { if (!is_array($fields) or (count($fields) < 1)) { throw new \Exception('Record set (update) requires one or more fields to be provided'); } array_map('htmlentities', $fields); if (isset($fields['id'])) { $id = $fields['id']; unset($fields['id']); } else { throw new \Exception('Record set (update) requires a row id to be provided'); } $values = array(); foreach ($fields as $key => $value) { $values[] = "`{$key}` = '{$value}'"; } $q = 'UPDATE '.$table.' SET '.implode($values, ', ')." WHERE `id`='{$id}'"; return $q; } echo updateRecord('kognito_groups', array('id' => 1, 'test' => 'beep', 'name' => 'test'));

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.0.20.0400.07020.02
7.0.10.0070.07720.23
7.0.00.0070.05720.17
5.6.170.0270.06320.44
5.6.160.0030.05320.63
5.6.150.0030.05718.30
5.6.140.0030.04718.33
5.6.130.0100.04718.21
5.6.120.0070.03721.03
5.6.110.0070.07321.11
5.6.100.0100.08321.02
5.6.90.0030.07020.94
5.6.80.0070.08020.41
5.5.310.0330.05720.34
5.5.300.0070.05317.98
5.5.290.0130.06017.99
5.5.280.0130.08020.66
5.5.270.0070.06020.84
5.5.260.0100.05020.64
5.5.250.0070.08020.65
5.5.240.0030.03020.27

preferences:
135.66 ms | 1394 KiB | 7 Q