According to http://php.net/manual/en/function.urldecode.php, PHP does urldecode()
on $_GET
and on $_REQUEST
(which contains $_POST
).
But is directly calling $_POST
already decoded?
PHP | urldecode() FunctionThe 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.
PHP | urlencode() Function. The urlencode() function is an inbuilt function in PHP which is used to encode the url. This function returns a string which consist all non-alphanumeric characters except -_. and replace by the percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.
This is a type of encoding-decoding approach where the built-in PHP functions urlencode() and urldecode()are implemented to encode and decode the URL, respectively. This encoding will replace almost all the special characters other than (_), (-), and (.) in the given URL.
UrlDecode(String) Converts a string that has been encoded for transmission in a URL into a decoded string. UrlDecode(Byte[], Encoding) Converts a URL-encoded byte array into a decoded string using the specified decoding object.
Yes, all the parameters you access via $_GET
and $_POST
are decoded.
The reason the urldecode()
documentation doesn't mention $_POST
is because the POST data might not be URL-encoded in the first place. It depends on whether the POST data is submitted in application/x-www-form-urlencoded
format or multipart/form-data
format.
But all this is transparent to the application.
The documentation of $_GET
does mention this explicitly, though.
Note:
The GET variables are passed throughurldecode()
.
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