Value of $var as a variable?

From: Date: Tue, 25 Feb 2003 01:47:25 +0000
Subject: Value of $var as a variable?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137018@lists.php.net to get a copy of this message
I know I've seen something about this (I can't remember whether yea or nay), but I can't remember where I found it as at the time I was looking for something else... and now that I'm looking for it I can't find it again. Anyways, what I've done is store variable names that end up being passed as part of various query strings in some variables similar to - $var_id = "id"; $var_name = "name"; In the file that receives the information I'd like to know if there's a faster way of finding out the value of the passed variables in the query string than a function that explodes the query string & returns the value of the requested variable. i.e. - function getID($variable) { // explode 'var=x' from query string $id = explode( "&", $_SERVER["QUERY_STRING"] ); // search to find correct 'var=x' from query string for( $i=0; $i<count($id); $i++ ) { // if $tag is found, extract value & assign to $value[] if( $r = eregi( $variable."=([0-9])*", $id[$i], $regs ) ) { $value[] = $regs[1]; } } return $value; } Patrick

« previous php.general (#137018) next »