considering this array :
$segments = array(
"key1" 开发者_高级运维 =>"111",
"key2" =>"222",
"key3" =>"333",
"key4" =>"444"
);
I want to have these:
$key1
has the value of "111";
$key2
has the value of "222";
$key3
has the value of "333";
$key4
has the value of "444";
What can I do ?
PHP has a built-in function that does exactly this:
extract($segments);
http://php.net/manual/en/function.extract.php
use
extract($segments)
References:
- extract Extract the keys of an hash array into the corresponding variables
- compact Does the reverse thing
精彩评论