Re: partly imploding an array...possible?

From: Date: Sun, 10 Aug 2003 22:08:48 +0000
Subject: Re: partly imploding an array...possible?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159065@lists.php.net to get a copy of this message
* Thus wrote Ryan A (ryan@jumac.com): > Hi, Hello Ryan, > $xxx=0; > foreach ($_GET as $a => $v) { > print "Current value of \$a:$a and \$v $v.\n <br>"; > $test=$a."=".$v; > $test1[$xxx]="".$test; > $xxx++; > } > > $someVar = implode( "&", $test1); > I'm not sure why your looping through all the _GET vars to build the query string when it already exists: $someVar = _SERVER["QUERY_STRING"]; > but i want to not get $test1's last component ($page) into $someVar...how do > i do that? > > Or another alternative would be to delete $page and $page's value from > $someVar Then you can modify it like so: $replace_from = 'page=' . $_GET['page']; $replace_to = 'page=' . ($_GET['page'] + 1); $someVar = str_replace($replace_from, $replace_to, $someVar); HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#159065) next »