php equivalent to javascript eval()? (or just a solution =o)
Posted: Mon Nov 25, 2002 9:34 pm
I'm using variables passed in through a form to generate pages of data dynamically (they're all on separate layers linked together, and I don't know how many pages beforehand). When I make the url for the link variables that represent different pages get numbers appended to them: &name0=name...&name1=name2...etc.
Anyway.
On the receiving end I'm running into the problem that I have to know the variable name before I try to output it, but I don't want to hardcode it.
I'd want something to the effect of:
But that will only give me the contents of $name + the integer 1, I want the contents of $name1.
In javascript you can use the eval() function to turn a string into an executable statement, I'm just wondering if there's an equivalent in php or someone knows how to help me with this problem.
Thanks ahead of time,
Justin
Anyway.
On the receiving end I'm running into the problem that I have to know the variable name before I try to output it, but I don't want to hardcode it.
I'd want something to the effect of:
Code: Select all
for ($i = 0; $i < $noofelements; $i++)
echo ($name+$i);In javascript you can use the eval() function to turn a string into an executable statement, I'm just wondering if there's an equivalent in php or someone knows how to help me with this problem.
Thanks ahead of time,
Justin