<?php
//var dump of $params shows: array(2) { [0] => string(2) [1]=> string(7) "renault" [1]=> string(20) "Alaskan" }
public function getSomething(string $sql, array $params): array {
$result = array();
$statement = $this->connection->prepare($sql);
$sql = "SELECT * FROM housemark WHERE merk LIKE ? AND (model LIKE ?) GROUP BY form ORDER BY form";
if ($statement) {
//var dump return true
call_user_func_array(array(&$statement, 'bind_param'), makeValuesReferenced($params));
if ($statement->execute()) {
$statement->store_result();
var_dump($statement);
if ($statement->num_rows >= 1) {
$statement->bind_result($id, $mark, $model, $form);
while ($rij = $statement->fetch()) {
$result[] = new Housemark($id, $mark, $model, $form);
}
}
}
}
var_dump($this->connection->error);
return $result;
}
function makeValuesReferenced(array $arr): array {
$refs = array();
foreach ($arr as $key => $value)
$refs[$key] = &$arr[$key];
return $refs;
}
- Output for 8.0.0
- Parse error: syntax error, unexpected token "public", expecting end of file in /in/5NrFe on line 6
Process exited with code 255. - Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
- Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /in/5NrFe on line 6
Process exited with code 255.
preferences:
157.87 ms | 943 KiB | 51 Q