A problem with eval()
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
Hey guys, it's been a few days since I was here. Tom was talking about potential username "lockdown" so I swaped my username. It's me - SexOnStreet (Nino).
Alright, here we go:
I need to make a variable via eval() - user defines the name of that variable via $op['var'].
I came with this:
ob_start();
echo $op['var'];
$gotop = ob_get_contents();
eval("ob_get_contents() = $op1.$string.$op2;");
ob_end_clean();
But IT doesn't work -- $op['var'] is nicely filled with, for example, $dtxt. But the variable isn't made.
Suggestions, please?
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
And yes, I know that third line isn't necessary.
- henke37
-
henke37
- Member since: Sep. 10, 2004
- Offline.
-
- Forum Stats
- Member
- Level 30
- Blank Slate
Why are you using eval? If you ask me it should at the very lest come dissabled by default.
Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
At 11/11/06 07:37 AM, henke37 wrote: Why are you using eval? If you ask me it should at the very lest come dissabled by default.
Then how would I do that?
1) User supplies an argument in a function.
2) I gotta make that variable which is supplied in argument and fill it with string.
eval() is the only choice
- authorblues
-
authorblues
- Member since: Jun. 21, 2005
- Offline.
-
- Forum Stats
- Member
- Level 12
- Blank Slate
At 11/11/06 11:40 AM, NinoGrounds wrote: eval() is the only choice
really? ever used double dollarsigns?
$myvariablename = 'bob';
$$myvariablename = 'tom';
echo $bob;
?>
- NinoGrounds
-
NinoGrounds
- Member since: Nov. 28, 2005
- Offline.
-
- Forum Stats
- Member
- Level 19
- Programmer
At 11/11/06 04:48 PM, authorblues wrote: really? ever used double dollarsigns?
nope


