Berkeley CSUA MOTD:Entry 36775
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/25 [General] UID:1000 Activity:popular
5/25    

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
Cache (180 bytes)
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'");