Maybe something similar to this?

function test($td){

    $global = "global \$$td"."_error, \$$td"."_ok;";
    eval($global);

    $set = "\$$td"."_error = \"ERROR\"; \$$td"."_ok = \"OK\";";
    eval($set);
}

test("foo");
echo "$foo_error $foo_ok";

--
Justin Garrett

"Martin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello!
>
> How can I make a variable, which name I give to a function, global in
> this function?
>
> I want to make something like:
>
> function MyFunc($sVarName)
> {    GLOBAL [$sVarName]_error, $sVarName_ok;
>     ....
> }
>
> So if $sVarName = "sHello", I want to access $sHello_error and
> $sHello_ok in this function.
>
> Any idea how I can make this variable gloabl and whats the easyst way to
> access this var then?
>
> Martin
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to