| ||||||
| 5/17 |
| 2005/3/20-22 [Computer/SW/Languages/Web] UID:36775 Activity:nil |
3/20 I know register globals in PHP are bad, but is there some lazy
programmer advantage to them?
\_ They let you be lazy. But it's really not worth it. Just use
something like my args() function:
http://bushong.net/dave/sw/files/args.php.txt
So just at the top of a script you say:
args('foo', 'bar[]', 'baz!');
And now you've got a string $foo, array $bar, and required
string $baz out of a query string like ?foo=42&bar[]=69&baz=18
--dbushong |
| bushong.net/dave/sw/files/args.php.txt can be passed one-by-one * * @author davidb */ function args() { $keys = func_get_args(); array_key_exists($key, $_REQUEST)) die("Missing required argument for this page: '$key'"); |