Re: [PHP] Name of variable to string [SOLVED]
At 4:56 PM -0500 2/8/08, Robert Cummings wrote: On Fri, 2008-02-08 at 16:51 -0500, tedd wrote: At 10:42 PM +0100 2/8/08, Jochem Maas wrote: >$post_var = @sessionize_post('post_var'); > >so why exactly is that not an option (or good idea)? It IS an option -- and that's what I was doing (except for the suppress error) via this: $post_var = sessionize_post('post_var'); I just wanted to make it simpler and do this: $post_var = sessionize_post($post_var); But, it turned out to be much more involved. It's just an adventure in key punching. It takes inefficiency to a whole new level. Cheers, Rob. Thanks Rob. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
At 1:39 PM -0800 2/8/08, Jim Lucas wrote: 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. First, I didn't say it was better. Second, you're not missing anything. Third, if I wanted to merge the arrays, I could use REQUEST and forget the merge. I was just trying to get the "check the current value of post or get variable and put it into a session" with a single simple statement of: $whatever = serialize($whatever); Now, I've have to continue with my original: $whatever = serialize('whatever'); When dealing with just a few variables, it's not a big deal. But, with the numbers I've been dealing with lately, I was looking to create something simple to cut and paste into. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
On Fri, 2008-02-08 at 16:51 -0500, tedd wrote: > At 10:42 PM +0100 2/8/08, Jochem Maas wrote: > >$post_var = @sessionize_post('post_var'); > > > >so why exactly is that not an option (or good idea)? > > It IS an option -- and that's what I was doing (except for the > suppress error) via this: > > $post_var = sessionize_post('post_var'); > > I just wanted to make it simpler and do this: > > $post_var = sessionize_post($post_var); > > But, it turned out to be much more involved. It's just an adventure > in key punching. It takes inefficiency to a whole new level. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
At 10:42 PM +0100 2/8/08, Jochem Maas wrote: $post_var = @sessionize_post('post_var'); so why exactly is that not an option (or good idea)? It IS an option -- and that's what I was doing (except for the suppress error) via this: $post_var = sessionize_post('post_var'); I just wanted to make it simpler and do this: $post_var = sessionize_post($post_var); But, it turned out to be much more involved. It's just an adventure in key punching. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
Daniel Brown schreef: On Feb 8, 2008 4:17 PM, tedd <[EMAIL PROTECTED]> 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//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)); I don't see why this has to be so convoluted - it would be a heck of a lot easier to do it with a string: $post_var = @sessionize_post('post_var'); so why exactly is that not an option (or good idea)? You see, there can be reasons why someone would want to know the variable's name. Thanks Daniel and to all who commented. And thank you for putting credit where it was really due. I knew I had gotten that code a couple of years ago from somewhere, but couldn't remember where. I hadn't written it, only modified it. I'm going to update my code now to put the "thanks to" section in there to the person who deserves the credit: Lucas Karisny (lucas dot karisny at linuxmail dot org). I had tried to find that each time I referenced the code or used it myself, but never did. If only I had R'd TFM. :-\ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
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//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
Re: [PHP] Name of variable to string [SOLVED]
On Feb 8, 2008 4:17 PM, tedd <[EMAIL PROTECTED]> 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//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. And thank you for putting credit where it was really due. I knew I had gotten that code a couple of years ago from somewhere, but couldn't remember where. I hadn't written it, only modified it. I'm going to update my code now to put the "thanks to" section in there to the person who deserves the credit: Lucas Karisny (lucas dot karisny at linuxmail dot org). I had tried to find that each time I referenced the code or used it myself, but never did. If only I had R'd TFM. :-\ -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string [SOLVED]
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//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 -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 2:45 PM, David Giragosian <[EMAIL PROTECTED]> wrote: > On 2/8/08, Eric Butera <[EMAIL PROTECTED]> wrote: Did you see the function that I published in this thread this morning? I'm nearly positive that's what he's looking for, and it worked for me. -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On 2/8/08, Eric Butera <[EMAIL PROTECTED]> wrote: > > On Feb 8, 2008 1:53 PM, David Giragosian <[EMAIL PROTECTED]> wrote: > > On 2/8/08, Richard Lynch <[EMAIL PROTECTED]> wrote: > > > > > > On Fri, February 8, 2008 9:14 am, tedd wrote: > > > > From a variable with the name of $this_variable -- how do I get a > > > > string 'this_variable' ? > > > > > > You don't... > > > > > > Consider this: > > > > > > function foo($bar){ > > > //what would your function output? > > > } > > > > > > $baz = 3; > > > foo($baz); > > > > > > -- > > > > > > If you dynamically created the variable: > > > > ${ 'something' . '_' . 'somethingElse' }; > > > > then you'd have access to it via the variable name parts. > > > > David > > > > That is ridiculous. > This is what I meant, as was posted just yesterday by someone (Jim Lucas?) for ( $i = 0 ; $i < 20 ; $i++ ) { $theVariableAsString = 'something_' . $i; ${ 'something' . '_' . $i } = "Assign something here"; } String value available here -> $theVariableAsString. I have no idea why tedd wants to have the string value of the variable nor how he will use it. David
Re: [PHP] Name of variable to string
On Feb 8, 2008, at 2:41 PM, Paul Scott wrote: On Fri, 2008-02-08 at 14:37 -0500, Daniel Brown wrote: On Feb 8, 2008 2:18 PM, Eric Butera <[EMAIL PROTECTED]> wrote: And look who chimes in with some helpful advice! ;-P lol (now isn't that even more useless?) Not worse then this... :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 2:41 PM, Paul Scott <[EMAIL PROTECTED]> wrote: > > On Fri, 2008-02-08 at 14:37 -0500, Daniel Brown wrote: > > On Feb 8, 2008 2:18 PM, Eric Butera <[EMAIL PROTECTED]> wrote: > > And look who chimes in with some helpful advice! ;-P > > > > lol > > (now isn't that even more useless?) That's why I threw the ;-P at the end. Not only to indicate that I was playing around, but also because it held double meaning (in words and action). TFGIF, brother! -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Fri, 2008-02-08 at 14:37 -0500, Daniel Brown wrote: > On Feb 8, 2008 2:18 PM, Eric Butera <[EMAIL PROTECTED]> wrote: > And look who chimes in with some helpful advice! ;-P > lol (now isn't that even more useless?) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 2:18 PM, Eric Butera <[EMAIL PROTECTED]> wrote: > That is ridiculous. And look who chimes in with some helpful advice! ;-P -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 1:53 PM, David Giragosian <[EMAIL PROTECTED]> wrote: > On 2/8/08, Richard Lynch <[EMAIL PROTECTED]> wrote: > > > > On Fri, February 8, 2008 9:14 am, tedd wrote: > > > From a variable with the name of $this_variable -- how do I get a > > > string 'this_variable' ? > > > > You don't... > > > > Consider this: > > > > function foo($bar){ > > //what would your function output? > > } > > > > $baz = 3; > > foo($baz); > > > > -- > > > If you dynamically created the variable: > > ${ 'something' . '_' . 'somethingElse' }; > > then you'd have access to it via the variable name parts. > > David > That is ridiculous. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On 2/8/08, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Fri, February 8, 2008 9:14 am, tedd wrote: > > From a variable with the name of $this_variable -- how do I get a > > string 'this_variable' ? > > You don't... > > Consider this: > > function foo($bar){ > //what would your function output? > } > > $baz = 3; > foo($baz); > > -- If you dynamically created the variable: ${ 'something' . '_' . 'somethingElse' }; then you'd have access to it via the variable name parts. David
Re: [PHP] Name of variable to string
On Fri, February 8, 2008 9:14 am, tedd wrote: > From a variable with the name of $this_variable -- how do I get a > string 'this_variable' ? You don't... Consider this: function foo($bar){ //what would your function output? } $baz = 3; foo($baz); -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
tedd wrote: Hi gang: From a variable with the name of $this_variable -- how do I get a string 'this_variable' ? Cheers, tedd At some point or the other you will have to define $this_variable as $this_variable, so at that point you will have access to the string 'this_variable'. Even if you define it using variable vairables or within or for each loop (e.g. get_definied_vars, $_POST) you will have an oppertunity to get the 'this_variable' string. Ade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 10:25 AM, Jason Pruim <[EMAIL PROTECTED]> 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' ? > > > Hey tedd, > > What is the end result you want? for debugging and checking variable > contents, I've simply: echo "this_variable = $this_variable"; > > But that was just for debugging, in a large environment, it could be > quite tedious to type all that out... What Tedd means is this: ;-P $v) { if($v === $new) { $vname = $p; } } $var = $old; return $vname; } ?> -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
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' ? Hey tedd, What is the end result you want? for debugging and checking variable contents, I've simply: echo "this_variable = $this_variable"; But that was just for debugging, in a large environment, it could be quite tedious to type all that out... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Name of variable to string
On Feb 8, 2008 10:14 AM, tedd <[EMAIL PROTECTED]> wrote: > Hi gang: > > From a variable with the name of $this_variable -- how do I get a > string 'this_variable' ? > > Cheers, > > tedd > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > There really isn't a way to do this. Maybe you could do some get_defined_vars hackery, but that really isn't practical. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Name of variable to string
Hi gang: From a variable with the name of $this_variable -- how do I get a string 'this_variable' ? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php