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...
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
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';
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
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
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
$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
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
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
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]
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
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
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
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
I've used variable variables probably 5 times in 2 years. They are great when
you need them, but don't usually have a day-to-day use for them.
Here is some sample code of the last time I used it.
if(isset($$key))
{
print($$key);
continue;
On 3/10/07, Matt Carlson [EMAIL PROTECTED] wrote:
I've used variable variables probably 5 times in 2 years. They are great
when you need them, but don't usually have a day-to-day use for them.
Here is some sample code of the last time I used it.
if(isset($$key))
{
I'd agree with Tijnema! here, variable variables aren't really of any
use here. However, a classic snippet of code is where one emulates
register_globals functionality in a non-register_globals environment
(not a good idea to do this btw, unless you know what you're doing and
don't have any
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
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
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:
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
* 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
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
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';
-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 =
-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
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 =
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
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:
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
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
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,
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
there's one example of var-of-vars along with arrays below my rant
rant
var-of-var is almost always an evil thing. there are some
rare instances where they're necessary, but i assure you
that your script would be MUCH cleaner and easier to modify
in the future if you used a simple array.
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 =
$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) {
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
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
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
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-
From: Jason Stechschulte [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 6:38 AM
To: John Meyer
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP
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
41 matches
Mail list logo