note 5860 deleted from language.variables.scope by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 21:47:20 +0000 |
| Subject: | note 5860 deleted from language.variables.scope by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22239@lists.php.net to get a copy of this message | ||
<pre>
The GLOBALS["somevar"] construct is ONLY local, that is, it's passed by value not by
referance!
Ouch!
P.S.
Globals *when used right* are great!
I've built a generic form data parser for a database frountend.
It has no idea up front what most of it's veriables are, just the name of the table is passed
in.
Then it gets the structure for the table from the database ...
... and looks for global veriables named after the fields in the table, using $GLOBALS[$varname].
It also does data validation based on the field type, size, NULL's allowed, default... from the
database.
Add a new table, add a new frontend form for data entry, presto, use the SAME PARSER, UNTOUCHED!
Do that with out global veriables.
Only glitch is one field that is the sum of other fields and I want to calculate it in the parser
and
put the answer back into the global variable as if it were there all along (to pass it back).
But the GLOBALS[] constuct is only local :-(
Terry
</pre>