Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent of JavaScript's decodeURIcomponent in PHP?

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()?

like image 924
neonant Avatar asked Oct 09 '10 08:10

neonant


People also ask

What is difference between decodeURI and 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.

What is decodeURIComponent?

The decodeURIComponent() function decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.

How decode URL in PHP?

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.

Why do we use decodeURIComponent?

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.


1 Answers

urldecode() 

However you do not need to use it on $_REQUEST variables, which are already decoded automatically.

like image 103
Explosion Pills Avatar answered Sep 28 '22 00:09

Explosion Pills