Encode URL in Php

Syntax

string urlencode($input)

Example:

echo urlencode("https://example.com/") . "\n";

Result:

https%3A%2F%2Fgeeksexample.com%2F


Decode URL in Php

Syntax

string urldecode($input)

Example:

echo urldecode("https%3A%2F%2Fgeeksexample.com%2F") . "\n";

Result:

https://example.com/