note 106967 added to function.urldecode

From: Date: Thu, 22 Dec 2011 00:01:19 +0000
Subject: note 106967 added to function.urldecode
Groups: php.notes 
Request: Send a blank email to php-notes+get-185197@lists.php.net to get a copy of this message
// Gets rid of 'amp;' in $_GET param names - so $_GET['amp;myVar'] becomes $_GET['myVar'] // Made this because sometimes '&' will wind up in the URL, as in: // http://sugarscript.com/index.php?aaa=111&myVar=222 // Call this function at the top of your php page: unmake_amps(); function unmake_amps() { foreach ($_GET as $g_param=>$g_value) { if (preg_match('/^amp\;(.*)$/i', $g_param)) { $g_paramNew = preg_replace('/^amp\;(.*)$/i', '$1', $g_param); unset($_GET[$g_param]); if ($g_paramNew != '') { // Only if $g_paramNew has a value, becaues sometimes '&' winds up at the end of a url ($_GET['amp;']) $_GET[$g_paramNew] = $g_value; } } } } Geek note: only for one-dimensional $_GET arrays - too lazy to make this a recursive function. ---- Server IP: 69.147.83.197 Probable Submitter: 128.196.6.46 ---- Manual Page -- http://www.php.net/manual/en/function.urldecode.php Edit -- https://master.php.net/note/edit/106967 Del: integrated -- https://master.php.net/note/delete/106967/integrated Del: useless -- https://master.php.net/note/delete/106967/useless Del: bad code -- https://master.php.net/note/delete/106967/bad+code Del: spam -- https://master.php.net/note/delete/106967/spam Del: non-english -- https://master.php.net/note/delete/106967/non-english Del: in docs -- https://master.php.net/note/delete/106967/in+docs Del: other reasons-- https://master.php.net/note/delete/106967 Reject -- https://master.php.net/note/reject/106967 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185197) next »