function value($type, $val)
{
switch ($type) {
case self::PARAM_FLOAT:
return (double) (is_string($val) ? str_replace(',', '.', preg_replace('/([.,])(?!\\d+$)/', '', $val)) : $val);
case \PDO::PARAM_NULL:
return (unset) $val;
case \PDO::PARAM_INT:
return (int) $val;
case \PDO::PARAM_BOOL:
return (bool) $val;
case \PDO::PARAM_STR:
return (string) $val;
case \PDO::PARAM_LOB:
return (string) $val;
}
}