当前位置:网站首页>PHP converts a one-dimensional array into a two-dimensional array
PHP converts a one-dimensional array into a two-dimensional array
2022-07-03 16:33:00 【Leaf drop traceless 123】
$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
$fruit = array(
array('key'=>'a', 'val'=>'apple'),
array('key'=>'b', 'val'=> 'banana'),
array('key'=>'c', 'val'=> 'cranberry')
);
$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
$tmp = array();
reset($fruit);
while (list($key, $val) = each($fruit)) {
$tmp[] = array('key'=>$key,'val'=>$val);
}
print_r($tmp);
边栏推荐
- [combinatorics] non descending path problem (number of non descending paths with constraints)
- Construction practice camp - graduation summary of phase 6
- What is the maximum number of concurrent TCP connections for a server? 65535?
- Golang 匿名函数使用
- Unity项目优化案例一
- [proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
- Golang anonymous function use
- PHP secondary domain name session sharing scheme
- [combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
- Mb10m-asemi rectifier bridge mb10m
猜你喜欢
TCP congestion control details | 3 design space
Zebras are recognized as dogs, and Stanford found the reason why AI made mistakes
Cocos Creator 2.x 自动打包(构建 + 编译)
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
Initial test of scikit learn Library
斑马识别成狗,AI犯错的原因被斯坦福找到了
Détails du contrôle de la congestion TCP | 3. Espace de conception
面试官:JVM如何分配和回收堆外内存
Explore Cassandra's decentralized distributed architecture
Thread pool executes scheduled tasks
随机推荐
(补)双指针专题
用通达信炒股开户安全吗?
Data driving of appium framework for mobile terminal automated testing
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
[combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
Unity项目优化案例一
相同切入点的抽取
为抵制 7-Zip,列出 “三宗罪” ?网友:“第3个才是重点吧?”
[statement] about searching sogk1997 and finding many web crawler results
Cocos Creator 2.x 自动打包(构建 + 编译)
8 tips for effective performance evaluation
架构实战营 - 第 6 期 毕业总结
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
在ntpdate同步时间的时候出现“the NTP socket is in use, exiting”
Unreal_DataTable 实现Id自增与设置RowName