PHP rawurldecode() Function – Description, Parameters, Return Value, and Examples
rawurldecode() is a PHP function that decodes URL‑encoded strings by converting percent‑encoded hexadecimal sequences back to their original characters, returning the decoded string; the article explains its usage, parameters, return value, and provides example code demonstrating its behavior compared to urlencode and urldecode.
rawurldecode() decodes an URL‑encoded string by converting each percent‑sign followed by two hexadecimal digits back to its original character, returning the decoded string.
Parameters: $str – the URL string to decode.
Return value: The decoded URL string.
Example 1:
<?php
echo rawurldecode('foo%20bar%40baz');
// foo bar@baz
?>Example 2:
<?php
$query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar);
echo '<a href="mycgi?' . htmlentities($query_string) . '">';
?>Note: rawurldecode() does not convert plus signs ('+') to spaces, whereas urldecode() does.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.