note 96451 deleted from reserved.variables.request by danbrown

From: Date: Mon, 01 Mar 2010 16:03:52 +0000
Subject: note 96451 deleted from reserved.variables.request by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166506@lists.php.net to get a copy of this message
Note Submitter: cosmo ---- That's a really ugly code example, sry. So here's my own modification which allows you to specify more than only one GET parameter. It also updates existing GET variables: public static function GenerateGETParameters( $parameters ) { $output = '?'; // Generate parameters from existing $_GET entrys. foreach( $_GET as $key => $value ) { // Update existing parameter values. if (isset( $parameters[ $key ] )){ $value = $parameters[ $key ]; unset( $parameters[ $key ] ); } if (strlen( $output ) > 1) $output .= '&'; $output .= $key . '=' . urlencode( $value ); } // Add the new parameters foreach( $parameters as $key => $value ) { if (strlen( $output ) > 1) $output .= '&'; $output .= $key . "=" . urlencode( $value ); } return htmlentities( $output ); }

« previous php.notes (#166506) next »