note 108896 added to reserved.variables.get

From: Date: Sat, 02 Jun 2012 18:50:23 +0000
Subject: note 108896 added to reserved.variables.get
Groups: php.notes 
Request: Send a blank email to php-notes+get-188370@lists.php.net to get a copy of this message
A smaller version of getUrlWithout using http_build_query, parse_str and array functions. And changing the function to accept a querystring argument; IMO it would be better to separate handling the rest of the url. <?php function getUrlWithout ($querystring, $getNames) { parse_str ($querystring, $arrQS); return http_build_query (array_diff_key ($arrQS, array_flip ($getNames))); } $querystring = "getVar1=Something&getVar2=10&getVar3=ok"; echo getUrlWithout($querystring, array("getVar1","getVar3")); ?> returns getVar2=10 ---- Server IP: 69.147.83.197 Probable Submitter: 67.165.230.170 ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.get.php Edit -- https://master.php.net/note/edit/108896 Del: integrated -- https://master.php.net/note/delete/108896/integrated Del: useless -- https://master.php.net/note/delete/108896/useless Del: bad code -- https://master.php.net/note/delete/108896/bad+code Del: spam -- https://master.php.net/note/delete/108896/spam Del: non-english -- https://master.php.net/note/delete/108896/non-english Del: in docs -- https://master.php.net/note/delete/108896/in+docs Del: other reasons-- https://master.php.net/note/delete/108896 Reject -- https://master.php.net/note/reject/108896 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188370) next »