Backend Development 2 min read

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.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP rawurldecode() Function – Description, Parameters, Return Value, and Examples

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.

BackendPHPfunctionsrawurldecodeURL decoding
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.