Last active
November 15, 2018 09:58
-
-
Save scsskid/74e623465bb8726296027a17de050fcd 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
<?php | |
function addUrlParam($url, $param) { | |
$url_parts = parse_url($url); | |
parse_str($url_parts['query'], $params); | |
$params[$param[0]] = $param[1]; | |
$url_parts['query'] = http_build_query($params); | |
//return http_build_url($url_parts); //pecl | |
return $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'] . '?' . $url_parts['query']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment