Re: Name of variable to string [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
At 10:31 AM -0500 2/8/08, Daniel Brown wrote:
 > On Feb 8, 2008, at 10:14 AM, tedd wrote:

 > Hi gang:
 >
 > From a variable with the name of $this_variable -- how do I get a
 > > string 'this_variable' ?

    What Tedd means is this:  ;-P

BINGO! We have a winner!

For those of you who want to know what I'm doing with the solution, please review:

 http://www.webbytedd.com/bbbb/var-string/index.php

Warning: Geek meters should be worn at all times and exposure should be limited. All code is shown.

The "problem" that I was seeking a solution for was simply an easier way to grab POST and GET variables and place them into SESSIONs while keeping the most current values current.

I'm a little disappointed in the solution because I wanted the statements to be:

$post_var = sessionize_post($post_var);
$get_var = sessionize_get($ger_var);

But, the function provided by Daniel (and found in the literature) would not work from within my session_post and session_get functions -- I think it's probably something to do with the scope of the variable.

In any event, I had to alter the calls to:

$post_var = @sessionize_post($post_var, vname($post_var)); $get_var = @sessionize_get($get_var, vname($get_var));

You see, there can be reasons why someone would want to know the variable's name.

Thanks Daniel and to all who commented.

Cheers,

tedd


So, how is this any better then just doing this

$_SESSION = array_merge(array_merge($_SESSION, $_POST), $_GET);

If I replace the two calls to sessionize_*() with the above line, I get the same results. Not sure what I am missing.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux