Jump to content

Archived

This topic is now archived and is closed to further replies.

mister_t101

dynamically create variables

Recommended Posts

Is there a way to dynamically create variables by traversing an array, then naming the variable with the position in the array?

for example....

for ($i=0; $i<count($_SESSION['order']); $i++)
{
create variable named $posei;
$posei=$i;
}

Thanks for the help

Share this post


Link to post
Share on other sites
Why not use a second array?

Share this post


Link to post
Share on other sites
Yes. Look at [a href=\"http://www.php.net/manual/en/language.variables.variable.php\" target=\"_blank\"]variable variables[/a].

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.