Results 1 to 1 of 1
I use to report error descriptions a global variable, wich is used when displaying my HTML forms.
I know that this is stupid, but I have no idea because it ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-16-2005 #1Linux User
- Join Date
- Aug 2005
- Location
- Italy
- Posts
- 401
PHP global variables... doesn't work!
I use to report error descriptions a global variable, wich is used when displaying my HTML forms.
I know that this is stupid, but I have no idea because it doesn't works...
If I mark a variable "global", this variable refer to the global scope right? So if I declare this variable in each script function, all variables in all function will refer to the same global variable, so consequently al modifications are visible to each other.
This is not true for me...
What's wrong? I've misunderstood global directive?Code:function foo() { global $errdescr; $errdescr = "Not implemented foo()! "; } function main_foo() { global $errdescr; foo(); echo "$errdescr"; /* XXX This doesn't print anything!!!!! */ }
Thanks...
P.S.:
I know I can use $GLOBALS['errdescr'], but I don't like to use do much time expansive expressions...When using Windows, have you ever told "Ehi... do your business?"
Linux user #396597 (http://counter.li.org)


Reply With Quote
