Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

rawurldecode()

Replace percent-encoded byte pairs with their original bytes in a URL component.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

rawurldecode(string $string): string

Replace percent-encoded byte pairs with their original bytes in a URL component. A literal plus remains plus, while %20 becomes a space. Malformed percent escapes are left in the text, so decoding alone does not validate input.

Signature

rawurldecode(string $string): string

Example output

["a+b c+d","%ZZ","00ff"]

Examples

<?php
echo json_encode([rawurldecode("a+b%20c%2Bd"),rawurldecode("%ZZ"),bin2hex(rawurldecode("%00%FF"))]);

Result

["a+b c+d","%ZZ","00ff"]

Sources