1 2 3 4 5 6 7 8 9 10
<?php $string='http://www.example.com/username?refid=22'; $url = parse_url($string); unset($url['query']); echo array_shift($url) . '://' . implode($url);
1
http://www.example.com/username