The urlencode() function is an inbuilt function in PHP which is used to encode the url. This function returns a string which consist all non-alphanumeric characters except -_. and replace by the percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.
Syntax:
string urlencode( $input )
Parameters: This function accepts single parameter $input which is used to hold the url to be encoded.
Return Value: This function returns an encoded string on success.
Below programs illustrate the urlencode() function in PHP:
Program 1:
<?php // PHP program to illustrate urlencode function ?> |
https%3A%2F%2Fgeeksforgeeks.org%2F
Program 2 :
<?php // PHP program to illustrate urlencode function ?> |
https%3A%2F%2Fide.geeksforgeeks.org%2F https%3A%2F%2Fcontribute.geeksforgeeks.org%2F https%3A%2F%2Fpractice.geeksforgeeks.org%2F https%3A%2F%2Fgeeksforgeeks.org%2F
Reference: http://php.net/manual/en/function.urlencode.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to Check a Function is a Generator Function or not using JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- CSS max() Function
- D3.js zip() Function
- PHP | ord() Function
- p5.js | mag() Function
- CSS env() Function
- D3.js | d3.sum() function
- D3.js | d3.mean() function
- p5.js | abs() function
- PHP | chr() Function
- PHP | next() Function
- CSS min() Function
- PHP Ds\Set sum() Function
- PHP Ds\Set get() Function
- PHP | Ds\Map get() Function
- D3.js now() function
- p5.js | value() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : julthep

