protected function prepareParams($query, $sqlParams)
    {
        if (empty($sqlParams)) {
            $sqlParams = [];
        }
        uksort(
            $sqlParams,
            function ($k1, $k2) {
                return strlen($k1) < strlen($k2);
            }
        );
        $resultQuery = $query;
        $paramNum = 0;
        foreach ($sqlParams as $paName => $paValue) {
            if (gettype($paValue)==="array") {
                $paramList = [];
                foreach ($paValue as $i=>$value) {
                    // $paramList[] = $paName . "_param$i";
                    $paramList[] = ":pdoParam$paramNum";
                    $paramNum++;
                }
                $resultQuery = str_replace($paName, implode(",", $paramList), $resultQuery);
            }
        }
        return $resultQuery;
    }
protected function prepareParams($query, $sqlParams)
    {
        if (empty($sqlParams)) {
            $sqlParams = [];
        }
        uksort(
            $sqlParams,
            function ($k1, $k2) {
                return strlen($k1) < strlen($k2);
            }
        );
        $resultQuery = $query;
        $paramNum = 0;
        foreach ($sqlParams as $paName => $paValue) {
            if (gettype($paValue)==="array") {
                $paramList = [];
                foreach ($paValue as $i=>$value) {
                    // $paramList[] = $paName . "_param$i";
                    $paramList[] = ":pdoParam$paramNum";
                    $paramNum++;
                }
                $resultQuery = str_replace($paName, implode(",", $paramList), $resultQuery);
            }
        }
        return $resultQuery;
    }
protected function prepareParams ( $ query , $ sqlParams ) { if ( empty ( $ sqlParams ) ) { $ sqlParams = [ ] ; } uksort ( $ sqlParams , function ( $ k1 , $ k2 ) { return strlen ( $ k1 ) < strlen ( $ k2 ) ; } ) ; $ resultQuery = $ query ; $ paramNum = 0 ; foreach ( $ sqlParams as $ paName => $ paValue ) { if ( gettype ( $ paValue ) === "array" ) { $ paramList = [ ] ; foreach ( $ paValue as $ i => $ value ) { // $paramList[] = $paName . "_param$i"; $ paramList [ ] = ":pdoParam$paramNum" ; $ paramNum ++ ; } $ resultQuery = str_replace ( $ paName , implode ( "," , $ paramList ) , $ resultQuery ) ; } } return $ resultQuery ; }
Prepare SQL statement

@param string $query     Query need to bind params
@param array  $sqlParams The parameters will be bound to query

@return string Procesed query
Prepare SQL statement