Re: [PHP] Pass Variable Names to a Function

2008-02-05 Thread Daniel Brown
On Feb 4, 2008 8:24 PM, Richard Lynch [EMAIL PROTECTED] wrote: function silly($var){ return isset($_SESSION[$var]) ? $_SESSION[$var] : ''; } silly('foo'); There's also ? ipitythe('foo'); ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? --

Re: [PHP] Pass Variable Names to a Function

2008-02-04 Thread Richard Lynch
function silly($var){ return isset($_SESSION[$var]) ? $_SESSION[$var] : ''; } silly('foo'); On Fri, February 1, 2008 10:49 am, Bill Guion wrote: I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not.

Re: [PHP] Pass Variable Names to a Function

2008-02-01 Thread Greg Donald
On Feb 1, 2008 10:49 AM, Bill Guion [EMAIL PROTECTED] wrote: I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like function set_var($var) { echo var = $var \n; echo \$var =

[PHP] Pass Variable Names to a Function

2008-02-01 Thread Bill Guion
I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like function set_var($var) { echo var = $var \n; if (isset($_SESSION['$var'])) { return $_SESSION['$var']; } else

Re: [PHP] Pass Variable Names to a Function

2008-02-01 Thread Richard Heyes
Bill Guion wrote: I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like You really don't need a function for this: // Could use null instead of false $variable =