Getting URL Parameters in JavaScript & PHP

Being a web person I was so use to getting parameters from the URL in Java via the request.getParameter() method. I have found it really cool to use the same functionality in JavaScript and PHP.

Here is a JavaScript function:

function getParameter(name){
 	var out = "";
	var href = window.location.href;
	if ( href.indexOf("?") > -1 ) {
		var qs = href.substr(href.indexOf("?")).toLowerCase();
		var aqs = qs.split("&");
		for ( var i = 0; i < aqs.length; i++ ){
			if (aqs[i].indexOf(name.toLowerCase() + "=") > -1 ){
				var parm = aqs[i].split("=");
				out = parm[1];
				break;
			}
		}
	}
	return unescape(out);
}

Here is a PHP function:

function getParameter($parm) {
	$return = "";
	if (isset ($_REQUEST[$parm])) {
		$return = $_REQUEST[$parm];
	}
	return $return;
}