I have a string with unicode characters that I am transferring via HTTP. This string was encoded with Javascript's encodeURIcomponent()
. Is there an equivalent function in php to Javascript's decodeURIComponent()
?
decodeURI(): It takes encodeURI(url) string as parameter and returns the decoded string. decodeURIComponent(): It takes encodeURIComponent(url) string as parameter and returns the decoded string.
The decodeURIComponent() function decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.
PHP | urldecode() Function The urldecode() function is an inbuilt function in PHP which is used to decode url which is encoded by encoded() function. Parameters: This function accepts single parameter $input which holds the url to be decoded. Return Value: This function returns the decoded string on success.
The decodeURIComponent() function is used to decode URI components. In other words, it is useful when you want a quick function for a URL decode. The abbreviation URI refers to a URI. js library used to manage URLs.
urldecode()
However you do not need to use it on $_REQUEST variables, which are already decoded automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With