Globals problem
| From: | Dan Larsson | Date: | Fri, 14 Apr 2000 14:54:40 +0000 |
| Subject: | Globals problem | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13559@lists.php.net to get a copy of this message | ||
I have defined some global defaults in my php script. Some
initial scripts then modify and add to these. However the
modifications doesn't work, the defaults stick.
I've tried using the below (without success):
$varDefaultFoo = !isset($varDefaultFoo) ? "value" : $varDefaultFoo;
I'e come to the conclusion that this the way I'd have to do it:
<?
$variable="Jolt"
function foo() {
globals $variable;
$variable .= " Cola";
return $variable;
}
function bar() {
$variable=foo();
return Enjoy $variable;
}
?>
Can I do it any other way? I'd prefer it if I could store it in
some way without 'returning' and calling variables by functions
as described above.
Regards
------------
Dan Larsson