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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to