funcions using get/post/session/array
From: Frankenstein (sparmmonkey_at_yahoo.com)
Date: 10/05/04
- Next message: Steve O: "help please..."
- Previous message: Armando Padilla: "Re: PHP/MYSQL Question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Oct 2004 11:03:53 -0700
I'm trying to move away from counting on register globals. What would
be the ideal way to make generic funcions that could be used with
$_GET and $_POST and the like. Passing a lot of variables while
calling a function seems very cumbersome to me.
What do you think of the a solution like the following? Can you
suggest something better?
//A function that takes a reference to an array
function f(&$vars) {
$var1 = $vars['var1'];
$var2 = $vars['var2'];
}
f($_GET); //function call using get
f($_POST); //function call using get
$con['var1'] = 'yes';
$con['var2'] = 'no';
f($con); //function call using manually created array
- Next message: Steve O: "help please..."
- Previous message: Armando Padilla: "Re: PHP/MYSQL Question..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|