note 89692 modified in reserved.variables.get by danbrown

From: Date: Thu, 19 Mar 2009 15:03:57 +0000
Subject: note 89692 modified in reserved.variables.get by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152145@lists.php.net to get a copy of this message
the addget function below actually has more use when you dont use the recursive merge as such: <?php function AddGet($ArrayOrString){ if(is_array($ArrayOrString)) return http_build_query(array_merge($GLOBALS['_GET'], $ArrayOrString)); parse_str($ArrayOrString, $output); return http_build_query(array_merge($GLOBALS['_GET'], $output)); } ?> In this case, if the key is added again with a different value it will be replaced with the new value. addget("change=true"); // ?change=true addget("change=false"); // ?change=false --was-- the addget function below actually has more use when you dont use the recursive merge as such: <? function AddGet($ArrayOrString){ if(is_array($ArrayOrString)) return http_build_query(array_merge($GLOBALS['_GET'], $ArrayOrString)); parse_str($ArrayOrString, $output); return http_build_query(array_merge($GLOBALS['_GET'], $output)); } ?> In this case, if the key is added again with a different value it will be replaced with the new value. addget("change=true"); // ?change=true addget("change=false"); // ?change=false http://php.net/manual/en/reserved.variables.get.php

« previous php.notes (#152145) next »