Return to Snippet

Revision: 24741
at March 10, 2010 04:41 by andyhartleeds


Initial Code
<?php
/**
 * Fetches back a string representation of the current $_GET array.
 *
 * @version 1.0
 * @author Andrew Hart
 *
 * @param array $exclusions[optional] Which items of the $_GET array to skip.
 * @return string The $_GET array in string format, eg: "action=add&value=test&this=true"
 */
function fetch_query_string($exclusions = array())
{
	$str = "";
	
	foreach ($_GET as $key => $val)
	{
		if (!in_array($key, $exclusions))
		{
			$str .= $key . "=" . $val . "&";
		}
	}
	
	$str = substr($str, 0, strlen($str) - 1);
	
	return $str;
}
?>

Initial URL


Initial Description


Initial Title
Fetch $_GET array as a string representation

Initial Tags
php, query

Initial Language
PHP