Re: variable in function parameter

From: Date: Mon, 28 Jul 2003 14:24:25 +0000
Subject: Re: variable in function parameter
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157182@lists.php.net to get a copy of this message
> * Thus wrote 386-DX (murat@robcol.k12.tr): > > Hello. Let's say I have something like this: > > > > function aa($test) { > > $a = 8; > > echo $test; > > } > > > > $a = 2; > > aa("a is ". ($a>5?"greater":"equal to or less"). " > > than 5".); > > http://php.net/eval No... you need to make $a global within the function for that change to affect $a outside the function function (...) { global $a; $a = 8; (can maybe do that in one operation, try it and see) ---John Holmes...

« previous php.general (#157182) next »