WC_API_Authentication::urlencode_rfc3986()public staticWC 2.4

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

Method of the class: WC_API_Authentication{}

No Hooks.

Return

String|Array. Encoded values

Usage

$result = WC_API_Authentication::urlencode_rfc3986( $value );
$value(string|array) (required)
The value to encode

Changelog

Since 2.4 Introduced.

WC_API_Authentication::urlencode_rfc3986() code WC 8.7.0

public static function urlencode_rfc3986( $value ) {
	if ( is_array( $value ) ) {
		return array_map( array( 'WC_API_Authentication', 'urlencode_rfc3986' ), $value );
	} else {
		// Percent symbols (%) must be double-encoded
		return str_replace( '%', '%25', rawurlencode( rawurldecode( $value ) ) );
	}
}