Created
June 12, 2016 14:30
-
-
Save dausruddin/b1a7fbd5f02e76b8a62a59d034f60c99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/a/7974253 | |
$encoded_url = preg_replace_callback('#://([^/]+)/([^?]+)#', function ($match) { | |
return '://' . $match[1] . '/' . join('/', array_map('rawurlencode', explode('/', $match[2]))); | |
}, $unencoded_url); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment