$oldArr = array('id=1','name=张三','sex=男');
$newArr = array();
foreach($oldArr as $v)
{
$t = explode('=',$v);
$newArr[$t[0]] = $t[1];
}
print_r($newArr);
把字符串形式的索引数组按等号拆分键值,构造为新的关联数组 PHP
最新推荐文章于 2023-12-21 00:25:08 发布
$oldArr = array('id=1','name=张三','sex=男');
$newArr = array();
foreach($oldArr as $v)
{
$t = explode('=',$v);
$newArr[$t[0]] = $t[1];
}
print_r($newArr);