public static function sql_prepare($str, $used_in_like = false)
    {
        if (!self::getInstance()->pdo_db) {
            self::getInstance()->connect();
        }

        if (is_array($str)) {
            foreach ($str as &$v) {
                $v = self::sql_prepare($v);
            }
        } else {
            $str = substr(self::getInstance()->pdo_db->quote(trim((string)$str)), 1, -1);

            if ($used_in_like) {
                $str = str_replace(['_', '%'], ['\_', '\%'], $str);
            }
        }

        return $str;
    }
public static function sql_prepare($str, $used_in_like = false)
    {
        if (!self::getInstance()->pdo_db) {
            self::getInstance()->connect();
        }

        if (is_array($str)) {
            foreach ($str as &$v) {
                $v = self::sql_prepare($v);
            }
        } else {
            $str = substr(self::getInstance()->pdo_db->quote(trim((string)$str)), 1, -1);

            if ($used_in_like) {
                $str = str_replace(['_', '%'], ['\_', '\%'], $str);
            }
        }

        return $str;
    }
public static function sql_prepare ( $ str , $ used_in_like = false ) { if ( ! self :: getInstance ( ) -> pdo_db ) { self :: getInstance ( ) -> connect ( ) ; } if ( is_array ( $ str ) ) { foreach ( $ str as & $ v ) { $ v = self :: sql_prepare ( $ v ) ; } } else { $ str = substr ( self :: getInstance ( ) -> pdo_db -> quote ( trim ( ( string ) $ str ) ) , 1 , - 1 ) ; if ( $ used_in_like ) { $ str = str_replace ( [ '_' , '%' ] , [ '\_' , '\%' ] , $ str ) ; } } return $ str ; }
retrieve value from associative array

@param mixed $str
@param bool  $used_in_like

@return string
retrieve value from associative array