Re: how to make a global scope array
| From: | David Nicholson | Date: | Sat, 26 Jul 2003 00:45:02 +0000 |
| Subject: | Re: how to make a global scope array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156974@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Sat, 26 Jul 2003 at
00:50, lines prefixed by '>' were originally written by you.
> Ouch!
> Sometimes I wish global didn't exist
Yes, it can be better to pass in a variable (by reference if you need
to write to it from within a function and not have it as the value
that you return), e.g.
function doSomething(&$a){
$a = 20;
return true; // to signify success
}
$a = 10;
doSomething($a);
echo $a; // prints 20
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)