Re: Variable scope

From: Date: Sat, 04 May 2002 14:22:47 +0000
Subject: Re: Variable scope
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-96048@lists.php.net to get a copy of this message
On Thursday 14 March 2002 21:53, George Nicolae wrote: > I have the following code: > > <? > function a($var_a) > { > b(); > } > > function b() > { > global $var_a; > echo $var_a; > } > > a("hello word!"); > ?> > > why function b() don't echo anything? Because $var_a has not, at any point, been defined in the global scope. > can I resolve this problem without > calling b($var_a)? I'm curious as to what you're trying to achieve. Could you enlighten me? -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "I will make no bargains with terrorist hardware." -- Peter da Silva */

« previous php.general (#96048) next »