public static function escapeFunction($parameter): string
    {
        $result = $parameter;

        switch (true) {
            // Check if result is non-unicode string using PCRE_UTF8 modifier
            case is_string($result) && !preg_match('//u', $result):
                $result = '0x' . strtoupper(bin2hex($result));
                break;

            case is_string($result):
                $result = "'" . addslashes($result) . "'";
                break;

            case is_array($result):
                foreach ($result as &$value) {
                    $value = static::escapeFunction($value);
                }

                $result = implode(', ', $result);
                break;

            case is_object($result):
                $result = addslashes((string) $result);
                break;

            case $result === null:
                $result = 'NULL';
                break;

            case is_bool($result):
                $result = $result ? '1' : '0';
                break;
        }

        return (string) $result;
    }
public static function escapeFunction($parameter): string
    {
        $result = $parameter;

        switch (true) {
            // Check if result is non-unicode string using PCRE_UTF8 modifier
            case is_string($result) && !preg_match('//u', $result):
                $result = '0x' . strtoupper(bin2hex($result));
                break;

            case is_string($result):
                $result = "'" . addslashes($result) . "'";
                break;

            case is_array($result):
                foreach ($result as &$value) {
                    $value = static::escapeFunction($value);
                }

                $result = implode(', ', $result);
                break;

            case is_object($result):
                $result = addslashes((string) $result);
                break;

            case $result === null:
                $result = 'NULL';
                break;

            case is_bool($result):
                $result = $result ? '1' : '0';
                break;
        }

        return (string) $result;
    }
public static function escapeFunction ( $ parameter ) : string { $ result = $ parameter ; switch ( true ) { // Check if result is non-unicode string using PCRE_UTF8 modifier case is_string ( $ result ) && ! preg_match ( '//u' , $ result ) : $ result = '0x' . strtoupper ( bin2hex ( $ result ) ) ; break ; case is_string ( $ result ) : $ result = "'" . addslashes ( $ result ) . "'" ; break ; case is_array ( $ result ) : foreach ( $ result as & $ value ) { $ value = static :: escapeFunction ( $ value ) ; } $ result = implode ( ', ' , $ result ) ; break ; case is_object ( $ result ) : $ result = addslashes ( ( string ) $ result ) ; break ; case $ result === null : $ result = 'NULL' ; break ; case is_bool ( $ result ) : $ result = $ result ? '1' : '0' ; break ; } return ( string ) $ result ; }
Escape parameters of a SQL query
DON'T USE THIS FUNCTION OUTSIDE ITS INTENDED SCOPE

@internal
Escape parameters of a SQL query DON T USE THIS FUNCTION OUTSIDE ITS INTENDED SCOPE