public quoteMulti ( array $list, string $sep = null ) : string | ||
$list | array | A series of key-value pairs where the key is the placeholder text and the value is the value to be quoted into it. If the key is an integer, it is assumed that the value is piece of literal text to be used and not quoted. |
$sep | string | Return the list pieces separated with this string (for example ' AND '), default null. |
Résultat | string | An SQL-safe string composed of the list keys and quoted values. |
public function quoteMulti($list, $sep = null)
{
$text = array();
foreach ((array) $list as $key => $val) {
if (is_int($key)) {
// integer $key means a literal phrase and no value to
// be bound into it
$text[] = $val;
} else {
// string $key means a phrase with a placeholder, and
// $val should be bound into it.
$text[] = $this->quoteInto($key, $val);
}
}
// return the condition list
$result = implode($sep, $text);
return $result;
}