3 ms·
PHP has methods for URL parsing. There's no need to approximate them with regexes: $query_string = parse_url($_SERVER["HTTP_REFERER"], PHP_URL_QUERY); pars
by pornel 16y ago
PHP has methods for URL parsing. There's no need to approximate them with regexes:
$query_string = parse_url($_SERVER["HTTP_REFERER"], PHP_URL_QUERY);
parse_str($query_string, $vars);
$term = $vars['q'];
$rank = $vars['cd'];
$url = $vars['url'];
Correct code is even shorter.