这是我的阵列:
Array ( [username] => john [email] => johnbobby123@gmail.com [first_name] => John [last_name] => Bobby)
如何为每个值分配一个关键变量?例如,
$key = $value
所以在这种情况下,它将是:
$username = 'john';
$email = 'johnbobby123@gmail.com';
etc...
答案 0 :(得分:1)
可能你需要php.extract:http://php.net/manual/en/function.extract.php
$array = ['username' => 'John', ...];
extract($array);
echo $username; // John
otherwise just echo $array['username'] // John