urldecode
Decodes a string from a URL.
Syntax
urldecode(string $string): stringParameters
| Parameter | Type | Description |
|---|---|---|
| $string | string | The encoded string. |
Return value
stringThe original string.
Examples
Decoding:
<?php
echo urldecode('tea+%26+coffee');Output:
tea & coffeeNotes
The values in $_GET are already decoded. Calling urldecode() again corrupts data containing % or +.
See also
In the tutorial
- HTTP requests and responses — How PHP receives a request and builds a response — the request method and address, headers, status codes, redirects and JSON responses.