
July 4th, 2003
05:39 PM
with Mr. Jones
Status: Offline!
Originally posted by EvilGenius
yeah i saw the function, but mine automatically remove slashes to all GPC vars, i dont need to call it when i need the variable
Yeah, I noticed that - I don't do it that way because i dont need it to do it to all vars.
___________________
http://www.philbrodeur.com - Expert PHP Development and Tutorials

July 4th, 2003
10:20 PM
Neversidian
Status: Offline!
Jeb: Thanks!
Ares: I think you have a point here, but since I use almost every GPC vars that i set, i do it that way
___________________
Jeremie - Used to be the Director of Community Development

July 5th, 2003
03:20 AM
I'm a Neverside Newbie?
Status: Offline!
foreach($_POST as $name=>$value) {
eval("\$POST_{$name}&=$value;");
}
foreach($_GET as $name=>$value) {
eval("\$GET_{$name}&=$value;");
}
and so on.
Last edited by CDude, July 5th, 2003 07:09 AM (Edited 1 times)

July 5th, 2003
07:09 AM
Originally posted by aMpLiFy
foreach($_POST as $name=>$value) {
eval("\$POST_{$name}&=$value;");
}
foreach($_GET as $name=>$value) {
eval("\$GET_{$name}&=$value;");
}
and so on.
or extract($_GET, EXTR_OVERWRITE, 'GET_');
___________________
http://celerondude.com

July 5th, 2003
11:06 AM
Neversidian
Status: Offline!
You can use
${'POST_' . $name}
instead of
eval("$POST_{$name}")
___________________
Jeremie - Used to be the Director of Community Development

July 5th, 2003
04:37 PM
I'm a Neverside Newbie?
Status: Offline!
Originally posted by CDude
or extract($_GET, EXTR_OVERWRITE, 'GET_');
yes, but the advantage of doing it my way is: &=
extract() will just make them normal variables.

July 5th, 2003
05:34 PM
have you looked at your code?
let's take the GET array for example.
index.php?name=James
the eval would be
$GET_name =& $James;
There is no variable $James;
You'd need quotes around $name and can't use reference.
___________________
http://celerondude.com

July 6th, 2003
03:42 AM
<?php
foreach($_SERVER as $key=>$val)
{
${$key} =& $_SERVER[$key];
}
?>
I believe that's what you're thinking of, amp. You want to make a reference to the superglobal array index. Since you can't make a reference to a string, I assumed this is where you were heading.
___________________
Adam Goossens -- PHP is my mother tounge.
Linux: ( kernel.org | winehq ) -- f33l the p0w3r.
Nobody replying to your questions? Getting flamed? Getting told to RTFM? Ask your questions the right way.

July 6th, 2003
06:37 AM
Neversidian
Status: Offline!
what's the point of this? I mean referencing every GPC vars..
Maybe adding quick compatibility for older scripts that didnt used the superglobals. But not for newer scripts
___________________
Jeremie - Used to be the Director of Community Development

July 7th, 2003
06:39 PM
I'm a Neverside Newbie?
Status: Offline!
It's been months since I've touched PHP... didn't even realize I had the =& backwards and that references aren't for strings. 
Last edited by amplify, July 7th, 2003 06:43 PM (Edited 1 times)