protected function bindParameter(\PDOStatement $stmt, $params, $types)
    {
        !is_array($params) && $params = array($params);
        !is_array($types) && $types = array($types);

        $isIndex = is_int(key($params));
        $index = 1;

        foreach ($params as $name => $param) {
            // Number index parameters
            if ($isIndex) {
                if (isset($types[$index - 1])) {
                    $stmt->bindValue($index, $param, $types[$index - 1]);
                } else {
                    $stmt->bindValue($index, $param);
                }
                $index++;
            // Named parameters
            } else {
                if (isset($types[$name])) {
                    $stmt->bindValue($name, $param, $types[$name]);
                } else {
                    $stmt->bindValue($name, $param);
                }
            }
        }
    }
protected function bindParameter(\PDOStatement $stmt, $params, $types)
    {
        !is_array($params) && $params = array($params);
        !is_array($types) && $types = array($types);

        $isIndex = is_int(key($params));
        $index = 1;

        foreach ($params as $name => $param) {
            // Number index parameters
            if ($isIndex) {
                if (isset($types[$index - 1])) {
                    $stmt->bindValue($index, $param, $types[$index - 1]);
                } else {
                    $stmt->bindValue($index, $param);
                }
                $index++;
            // Named parameters
            } else {
                if (isset($types[$name])) {
                    $stmt->bindValue($name, $param, $types[$name]);
                } else {
                    $stmt->bindValue($name, $param);
                }
            }
        }
    }
protected function bindParameter ( \ PDOStatement $ stmt , $ params , $ types ) { ! is_array ( $ params ) && $ params = array ( $ params ) ; ! is_array ( $ types ) && $ types = array ( $ types ) ; $ isIndex = is_int ( key ( $ params ) ) ; $ index = 1 ; foreach ( $ params as $ name => $ param ) { // Number index parameters if ( $ isIndex ) { if ( isset ( $ types [ $ index - 1 ] ) ) { $ stmt -> bindValue ( $ index , $ param , $ types [ $ index - 1 ] ) ; } else { $ stmt -> bindValue ( $ index , $ param ) ; } $ index ++ ; // Named parameters } else { if ( isset ( $ types [ $ name ] ) ) { $ stmt -> bindValue ( $ name , $ param , $ types [ $ name ] ) ; } else { $ stmt -> bindValue ( $ name , $ param ) ; } } } }
Bind parameters to statement object

@param \PDOStatement $stmt
@param array $params
@param array $types
Bind parameters to statement object