从具有未知长度和值名称的关联数组中提取每个值

I have an array like:

Array
(
    [item1] => value1
    [item2] => value
    [item3] => value3
)

And I want to extract all the names and values to variables. But say, I don't know the names of items that the array contains. I wanna generate variables for each array item with the name of this item name in array to make possible of using this variables later. The result should look like this:

item_name1 = item_value1
item_name2 = item_value2
item_name3 = item_value3

Seems the foreach loop should be usefull here.

I'm not sure if I understood this.

If you want the key from the array to become a variable with the same name you can use the extract function: http://php.net/manual/en/function.extract.php

Using built-in functions is always faster, but if you need the foreach approach with $$:

foreach ($array as $key=>$val)
{
    $$key = $val;
}