Example 1 — Decode a URL Path Text
Turn %20 and %21 back into a space and an exclamation mark.
<?php
$encoded = "Hello%20World%21";
echo rawurldecode($encoded), PHP_EOL; How It Works
- Start with encoded text.
%20is a space and%21is!. - Call rawurldecode(). Each
%XXbecomes one byte. - Get the readable text. Here you see
Hello World!. - Print it.
echoshows the result.

