wc_rest_urlencode_rfc3986()WC 2.6.0

Encodes a value according to RFC 3986. Supports multidimensional arrays.

No Hooks.

Return

String|Array. Encoded values.

Usage

wc_rest_urlencode_rfc3986( $value );
$value(string|array) (required)
The value to encode.

Changelog

Since 2.6.0 Introduced.

wc_rest_urlencode_rfc3986() code WC 8.7.0

function wc_rest_urlencode_rfc3986( $value ) {
	if ( is_array( $value ) ) {
		return array_map( 'wc_rest_urlencode_rfc3986', $value );
	}

	return str_replace( array( '+', '%7E' ), array( ' ', '~' ), rawurlencode( $value ) );
}