Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Urlencode and Urldecode in php

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 247
    Comment on it

    Hello Readers

    Urlencode can be used to encode the given string that can be used as a url. Urlencode replaces the ASCII characters with % followed by two hexadecimal digits.

    OR

    Other non-alphanumeric characters are converted % followed by two hex digits representing the converted character.

    Space characters are converted to + characters.

    It is normally used when the browser sends form data to a web server.

    Syntax of urlencode: urlencode (string $str )

    For example:

    $discount ="10.00%";
    $url = "http://domain.com/submit.php?disc=".urlencode($discount);
    echo $url;
    

    You will get the below output:

    "http://domain.com/submit.php?disc=10%2E00%25
    

    Urldecode can be used to decode the string. Decodes any "%##"" encoding in the given string. It is normally used when the browser sends form data to a web server.

    Syntax of urldecode: urldecode (string $str )

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: