Re: [PHP] Variable variables into an array.

2010-08-11 Thread Richard Quadling
On 10 August 2010 18:08, Andrew Ballard aball...@gmail.com wrote: On Tue, Aug 10, 2010 at 12:23 PM, Richard Quadling rquadl...@gmail.com wrote: On 10 August 2010 16:49, Jim Lucas li...@cmsws.com wrote: Richard Quadling wrote: Hi. Quick set of eyes needed to see what I've done wrong...

RE: [PHP] Variable variables into an array.

2010-08-11 Thread Bob McConnell
From: Richard Quadling Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry = 'Set[1]'; ^^ Shouldn't that be $Set[1]? $Value = 'Assigned'; $$Entry = $Value; print_r($Set); ? Bob McConnell -- PHP

Re: [PHP] Variable variables into an array.

2010-08-11 Thread Richard Quadling
On 11 August 2010 13:58, Bob McConnell r...@cbord.com wrote: From: Richard Quadling Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry = 'Set[1]';            ^^ Shouldn't that be $Set[1]? $Value = 'Assigned';

[PHP] Variable variables into an array.

2010-08-10 Thread Richard Quadling
Hi. Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry = 'Set[1]'; $Value = 'Assigned'; $$Entry = $Value; print_r($Set); ? The output is an empty array. Examining $GLOBALS, I end up with an entries ... [Set] = Array

Re: [PHP] Variable variables into an array.

2010-08-10 Thread Jim Lucas
Richard Quadling wrote: Hi. Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry = 'Set[1]'; $Value = 'Assigned'; $$Entry = $Value; print_r($Set); ? The output is an empty array. Examining $GLOBALS, I end up with an

Re: [PHP] Variable variables into an array.

2010-08-10 Thread Richard Quadling
On 10 August 2010 16:49, Jim Lucas li...@cmsws.com wrote: Richard Quadling wrote: Hi. Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry = 'Set[1]'; $Value = 'Assigned'; $$Entry = $Value; print_r($Set); ? The

Re: [PHP] Variable variables into an array.

2010-08-10 Thread Andrew Ballard
On Tue, Aug 10, 2010 at 12:23 PM, Richard Quadling rquadl...@gmail.com wrote: On 10 August 2010 16:49, Jim Lucas li...@cmsws.com wrote: Richard Quadling wrote: Hi. Quick set of eyes needed to see what I've done wrong... The following is a reduced example ... ?php $Set = array(); $Entry

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Richard Heyes
$varname = \$_SERVER['REMOTE_ADDR']; $varvalue = $$varname; That's wrong. Offhand you'll end up printing a string. I tried this: ?php $a = 365; $b = 366; $var = $_GET['var']; echo $$var; ? And it was fine. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Micah Gersten
That's fine as a test, but you never want to get a variable name from a URL in practice. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Richard Heyes wrote: $varname = \$_SERVER['REMOTE_ADDR']; $varvalue = $$varname; That's wrong. Offhand you'll

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Richard Heyes
That's fine as a test, but you never want to get a variable name from a URL in practice. Of course you can, as long as it's sanitized and checked. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.rgraph.org -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Variable Variables and Super Global Arrays

2008-10-12 Thread Micah Gersten
I mean that it is open for hacking if you pass a variable name through a URL. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com daniel danon wrote: What do you mean? On Sun, Oct 12, 2008 at 5:40 PM, Micah Gersten [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

[PHP] Variable Variables and Super Global Arrays

2008-10-10 Thread daniel danon
Hi, I was wondering, By php.net manual, Please note that variable variables cannot be used with PHP's Superglobal arrays within functions or class methods. Is there any way to override this problem? Just the not nice eval(return $variable);? and in simple words - is there any way to make the

Re: [PHP] Variable variables and references

2007-03-14 Thread Robert Cummings
On Wed, 2007-03-14 at 12:39 +0100, Jochem Maas wrote: Richard Lynch wrote: On Sat, March 10, 2007 6:28 am, Dave Goodchild wrote: Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not

Re: [PHP] Variable variables and references

2007-03-12 Thread Richard Lynch
On Sat, March 10, 2007 6:28 am, Dave Goodchild wrote: Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not the mechanics, just where you would use them. The subject of variable variables is

Re: [PHP] Variable variables and references

2007-03-11 Thread Martin Alterisio
2007/3/10, Dave Goodchild [EMAIL PROTECTED]: Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not the mechanics, just where you would use them. The subject of variable variables is explained

[PHP] Variable variables and references

2007-03-10 Thread Dave Goodchild
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not the mechanics, just where you would use them. The subject of variable variables is explained but no examples are given as to why and where

Re: [PHP] Variable variables and references

2007-03-10 Thread Tijnema !
I must say, in all the years i am programming with PHP (about 5-6 years) i NEVER used references. So i don't find it useful, but well, if you want to give your variable content more than one name, you can :) I think you just need to start programming now, keeping in mind they are available, but

Re: [PHP] Variable variables and references

2007-03-10 Thread Matt Carlson
: [PHP] Variable variables and references Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references - not the mechanics, just where you would use them. The subject of variable variables is explained

Re: [PHP] Variable variables and references

2007-03-10 Thread Tijnema !
sometimes you might (think you) need it. Tijnema - Original Message From: Dave Goodchild [EMAIL PROTECTED] To: PHP-General php-general@lists.php.net Sent: Saturday, March 10, 2007 5:28:57 AM Subject: [PHP] Variable variables and references Hi guys, I have just read 'Programming PHP

Re: [PHP] Variable variables and references

2007-03-10 Thread M.Sokolewicz
] To: PHP-General php-general@lists.php.net Sent: Saturday, March 10, 2007 5:28:57 AM Subject: [PHP] Variable variables and references Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think it's a great book, I am confused about variable variables and references

[PHP] Variable variables

2006-01-24 Thread Mark Steudel
I was wondering if you could create variable variables for objects, please see examples below, Im having problems getting it to work. $data['fieldname'] = foo; // without variable variables $res = $db-query( SELECT foo FROM table ); while( $res-fetchInto( $db_data ) )

[PHP] Variable variables

2004-08-28 Thread JanBro
Hi List, I'm using PHP5 with global variables off. I've got around 20 dynamically generated forms with a total of 300 different variables sent thru these forms. I'd like to use variable variables, but according to the manual this is not possible. Now comes my Questoin, how do I receive my

Re: [PHP] Variable variables

2004-08-28 Thread Marek Kilimajer
JanBro wrote: Hi List, I'm using PHP5 with global variables off. I've got around 20 dynamically generated forms with a total of 300 different variables sent thru these forms. I'd like to use variable variables, but according to the manual this is not possible. Now comes my Questoin, how do I

Re: [PHP] Variable variables

2004-08-28 Thread Justin Patrin
On Sat, 28 Aug 2004 11:43:13 +0200, JanBro [EMAIL PROTECTED] wrote: Hi List, I'm using PHP5 with global variables off. I've got around 20 dynamically generated forms with a total of 300 different variables sent thru these forms. I'd like to use variable variables, but according to the

[PHP] Variable Variables adn Superglobals

2004-08-04 Thread ARico
Using Variable Variables works fine inside functions for global defined variables if you declare them as global inside the function. Suprinsingly, it does not seem to work with superglobals. Take the following example: // code

Re: [PHP] Variable Variables adn Superglobals

2004-08-04 Thread Justin Patrin
On Wed, 04 Aug 2004 23:15:03 +0200, ARico [EMAIL PROTECTED] wrote: Using Variable Variables works fine inside functions for global defined variables if you declare them as global inside the function. Suprinsingly, it does not seem to work with superglobals. Take the following example:

Re: [PHP] Variable Variables adn Superglobals

2004-08-04 Thread ARico
Justin Patrin wrote: On Wed, 04 Aug 2004 23:15:03 +0200, ARico [EMAIL PROTECTED] wrote: Using Variable Variables works fine inside functions for global defined variables if you declare them as global inside the function. Suprinsingly, it does not seem to work with superglobals. Take the

Re: [PHP] Variable Variables adn Superglobals

2004-08-04 Thread Curt Zirzow
* Thus wrote ARico: Using Variable Variables works fine inside functions for global defined variables if you declare them as global inside the function. Suprinsingly, it does not seem to work with superglobals. Take the following example: // code

[PHP] Variable variables

2003-12-23 Thread Richard Baskett
Ok I am trying to create a variable from the value of a variable plus some extra text tagged on the end of it. So for example: $test = '_over'; $$CONFIG['island'].$test = 'testing'; echo hawaii = $hawaii_over; How can I do this? Im sure it's possible, but it just is not working for me :(

Re: [PHP] Variable variables

2003-12-23 Thread John W. Holmes
Richard Baskett wrote: Ok I am trying to create a variable from the value of a variable plus some extra text tagged on the end of it. So for example: $test = '_over'; $$CONFIG['island'].$test = 'testing'; ${$CONFIG['island'].$test} = 'testing'; echo hawaii = $hawaii_over; Why not just use an

Re: [PHP] Variable variables

2003-12-23 Thread Richard Baskett
on 12/23/03 11:04, John W. Holmes at [EMAIL PROTECTED] wrote: Richard Baskett wrote: Ok I am trying to create a variable from the value of a variable plus some extra text tagged on the end of it. So for example: $test = '_over'; $$CONFIG['island'].$test = 'testing';

RE: [PHP] Variable variables question?

2003-06-16 Thread Ford, Mike [LSS]
-Original Message- From: Douglas Douglas [mailto:[EMAIL PROTECTED] Sent: 14 June 2003 00:57 Thanks for the explanation, but I think this is a different case, isn't? I'm not trying to do this ${$_POST}, I'm trying to make this string $_POST. Then why not just make it: $var =

[PHP] Variable variables question?

2003-06-13 Thread Douglas Douglas
Hello everybody. I have the following class method: function HTTPValidator($method) { $this-data = ${'_'.$method}; $this-rules= array(); $this-required = array(); } data, rules and required are arrays. The parameter $method can have the values: GET or POST. I'm trying to store

RE: [PHP] Variable variables question?

2003-06-13 Thread Ford, Mike [LSS]
-Original Message- From: Douglas Douglas To: [EMAIL PROTECTED] To get the superglobal array ($_GET or $_POST), I try to build these strings '_'.$method. I'm sure this part works, PHP builds the string _GET or _POST according to the $method parameter. I use ${'_'.$method} to get the

RE: [PHP] Variable variables question?

2003-06-13 Thread Douglas Douglas
Thanks for the answer Mike. Thanks for the explanation, but I think this is a different case, isn't? I'm not trying to do this ${$_POST}, I'm trying to make this string $_POST. And I have another question. Why does this code work? ?php echo 'pre'; print_r($_POST); echo '/prebrbr'; $method =

Re: [PHP] Variable Variables

2002-09-13 Thread Marek Kilimajer
Hi, Mike Smith wrote: I am stumped on a project for a receiving system. I'm not sure how to handle receiving more than one line item. I can UPDATE ... WHERE id=$detid when I have 1 item, but how would I get the SQL to fire X times depending on the number of line items I have AND UPDATE the

[PHP] Variable Variables

2002-09-11 Thread Mike Smith
I am stumped on a project for a receiving system. I'm not sure how to handle receiving more than one line item. I can UPDATE ... WHERE id=$detid when I have 1 item, but how would I get the SQL to fire X times depending on the number of line items I have AND UPDATE the appropriate record.

Re: [PHP] variable variables i think... (solved)

2002-08-22 Thread Justin French
Solved it -- I *can* do what I wanted without variable variables... it was human error. Justin French on 22/08/02 4:09 PM, Justin French ([EMAIL PROTECTED]) wrote: Hi all, Having trouble with the logic behind this. I have a dynamic SKU, and a dynamic size_range array. Examples:

[PHP] variable variables i think...

2002-08-21 Thread Justin French
Hi all, Having trouble with the logic behind this. I have a dynamic SKU, and a dynamic size_range array. Examples: $sku = '44044'; $size_range = array('S', 'M', 'L'); Which I use to build a pull down select box: SELECT name=myselect ? foreach($sizes as $k = $v) { echo OPTION

[PHP] variable variables and Sessions

2002-07-30 Thread Anup
I have a question about the following $LoadResult = mysql_query(SELECT * from Items where username='test' and password='test'); $num_results =mysql_num_rows($LoadResult); for ($i=0; $i $num_results;$i++) { $myrow = mysql_fetch_array($LoadResult, MYSQL_ASSOC); $ProductName =

Re: [PHP] Variable Variables

2002-05-30 Thread Ed Gorski
use isset($$key); ed At 09:29 AM 5/30/2002 +1000, David Freeman wrote: Hi All, I've been trying to figure this out based on stuff on php.net but can't seem to get a result I need. I have an array: $formarray = array (form1 = var1, form2 = var2); And now I'm using that array to create a form

[PHP] Variable Variables

2002-05-29 Thread David Freeman
Hi All, I've been trying to figure this out based on stuff on php.net but can't seem to get a result I need. I have an array: $formarray = array (form1 = var1, form2 = var2); And now I'm using that array to create a form (fairly abbreviated): while (list($key, $val) = each($formarray)) {

RE: [PHP] Variable Variables

2002-05-29 Thread David Freeman
I've got as far as working out that $$key will give me the equivalent of $form1 but how do I then work out if $form1 has a value? Never mind, ${$key} was what I was looking for - my test case set the wrong variable and that's why it didn't seem to be working. CYA, Dave -- PHP

RE: [PHP] Variable Variables

2002-05-29 Thread Philip Olson
Never mind, ${$key} was what I was looking for - my test case set the wrong variable and that's why it didn't seem to be working. You may want to code with E_NOTICE errors showing. To show all levels, use error_reporting: error_reporting(E_ALL); This will show you undefined variables,

RE: [PHP] Variable Variables

2002-05-29 Thread David Freeman
You may want to code with E_NOTICE errors showing. To show all levels, use error_reporting: error_reporting(E_ALL); Yeah, I already do that... CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Variable Variables and Mulitdimensional Arrays

2002-03-15 Thread Charlie Killian
Hi. I want to be able to access a key in a multidimensional array at some depth n without knowing before runtime what the keys are. I thought this might be possible using variable variables. Here's some sample code using variable variables and multidimensional arrays: $y = 'a'; $z = 'b'; $t =

[PHP] variable variables

2002-01-17 Thread Mike Krisher
I can not wrap my head around variable variables today, not awake yet or something. For instance I trying something like this: while ($i$loopcounter) { $temp = size; $valueofsize = $$temp$i; $i++; } this doesn't work obviously, $valueofsize ends up with a literal value

RE: [PHP] variable variables

2002-01-17 Thread scott [gts]
PROTECTED]] Sent: Thursday, January 17, 2002 11:12 AM To: [EMAIL PROTECTED] Subject: [PHP] variable variables I can not wrap my head around variable variables today, not awake yet or something. For instance I trying something like this: while ($i$loopcounter) { $temp = size

Re: [PHP] variable variables

2002-01-17 Thread Steve Cayford
On Thursday, January 17, 2002, at 10:11 AM, Mike Krisher wrote: I can not wrap my head around variable variables today, not awake yet or something. For instance I trying something like this: while ($i$loopcounter) { $temp = size; $valueofsize = $$temp$i; try $valueofsize =

Re: [PHP] variable variables

2002-01-17 Thread [EMAIL PROTECTED]
$valueofsize = ${size . $i}; or $var = size . $i; $valueofsize = $$var; bvr. On Thu, 17 Jan 2002 11:11:43 -0500, Mike Krisher wrote: I can not wrap my head around variable variables today, not awake yet or something. For instance I trying something like this: while ($i$loopcounter) {

Re: [PHP] variable variables

2002-01-17 Thread Alister
On Thu, 17 Jan 2002 11:11:43 -0500, you wrote: I can not wrap my head around variable variables today, not awake yet or something. For instance I trying something like this: while ($i$loopcounter) { $temp = size; $valueofsize = $$temp$i; $i++; } What about $i = 0; // set

[PHP] Variable variables

2001-09-26 Thread Richard Baskett
I can not figure out why this is not working! for ($j=0; $j$resultNum; $j++) { $newvar = finalresult.$a; $$newvar[$a][name] = $resultRow[name]; $$newvar[$a][title]= $resultRow[title]; $$newvar[$a][descript] = $resultRow[descript]; $$newvar[$a][countkey] =

Re: [PHP] Variable variables

2001-09-26 Thread Philip Olson
If I'm reading your snippet correctly, then : $foo = 'bar'; $bar = array('apple','banana'); print ${$foo}[0]; // apple Note the use of {braces}. The last paragraph in the manual describes this a bit : http://www.php.net/manual/en/language.variables.variable.php Although I don't see

[PHP] variable variables and eval

2001-08-13 Thread William Bailey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, i have come across a strange problem with variable variables. Basicly i'm doing the following and its not working: $section = 'data[SITE][0][NAME][0]'; $pData = 'My Site.'; ${sprintf('$%s', $section)}.=$pData; but it is not working. But if

[PHP] Variable variables

2001-03-13 Thread John Meyer
Okay, I read about this feature in the php manual. What I can't figure out is why in the world would anybody want to use this feature? Not to start a flame war, just would like an explanation of why this feature is useful. -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Variable variables

2001-03-13 Thread Jason Stechschulte
On Tue, Mar 13, 2001 at 06:36:10AM -0700, John Meyer wrote: Okay, I read about this feature in the php manual. What I can't figure out is why in the world would anybody want to use this feature? Not to start a flame war, just would like an explanation of why this feature is useful. I've

RE: [PHP] Variable variables

2001-03-13 Thread John Meyer
] Variable variables On Tue, Mar 13, 2001 at 06:36:10AM -0700, John Meyer wrote: Okay, I read about this feature in the php manual. What I can't figure out is why in the world would anybody want to use this feature? Not to start a flame war, just would like an explanation of why this feature

RE: [PHP] Variable variables

2001-03-13 Thread PHPBeginner.com
Meyer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 13, 2001 10:47 PM To: Jason Stechschulte Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Variable variables Okay, that makes a little sense, but isn't there some sort of collection that will do the same thing (coming from vb). -Original Message