What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



urldecode — Decodes a URL-encoded string, converting plus (+) signs to spaces.


string urldecode(url_encoded_data);
string url_encoded_data: URL-encoded string


Decoded string; FALSE if the argument passed has no length when converted to a string


urldecode() is used to decode URL-encoded strings. The function converts all sequences of % followed by two valid hexadecimal digits into the ASCII character referenced by the hex number. Invalid escape sequences (such as %FG) are ignored and left in the string.

The function also converts plus (+) signs into spaces to accommodate the encoding generated by some URL-encoding algorithms.


PHP Version: 3+, 4+

See also



Example 1371. Manually decode a query string

// Pretend that a web server that doesn't really understand CGI passed us this query string
$query_string = 'SESSION_ID=192FFc92a9&user=cynical+user&action=delete&item=Give+it+a+110%89';

// Split the query string into separate name/value pairs
$nv_pairs = explode ('&', $query_string);

// urldecode and then display the name/value pairs in a nice format
foreach ($nv_pairs as $nv) {
    // Split the name/value pair into a name and a value
    list ($name, $value) = explode ('=', $nv);

    // Decode the name and value
    $name  = urldecode ($name);
    $value = urldecode ($value);

    // Display the name and value
    printf ("<b>Name:</b> %-12s <b>Value:</b> '%s'\n", $name, $value);

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.