3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ($servicedta as $update) { $update = array_intersect_key($update, $allowed); $id = array_pop($update); $values = array_values($update); $values[] = $id; $set = []; foreach ($update as $field => $value) { $set[] = '`'.$field.'`=?'; } $sql = 'UPDATE services_list SET ' . implode(', ', $set). ' WHERE serviceID=?' if($stmt=$connection->prepare($sql)) { $stmt->bind_param(str_repeat("s", count($set)+1), ...$values); } }
Output for 7.1.0 - 7.1.16, 7.2.0 - 7.2.4
Parse error: syntax error, unexpected 'if' (T_IF) in /in/R02PI on line 13
Process exited with code 255.

preferences:
166.72 ms | 1395 KiB | 29 Q