当前位置:网站首页>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);
边栏推荐
- Data driving of appium framework for mobile terminal automated testing
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
- Central South University | through exploration and understanding: find interpretable features with deep reinforcement learning
- Interviewer: how does the JVM allocate and recycle off heap memory
- Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
- 关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
- 利用MySQL中的乐观锁和悲观锁实现分布式锁
- Myopia: take off or match glasses? These problems must be understood clearly first
- 8 cool visual charts to quickly write the visual analysis report that the boss likes to see
- [combinatorics] non descending path problem (number of non descending paths with constraints)
猜你喜欢
Unreal_DataTable 实现Id自增与设置RowName
IDEA-配置插件
[solved] access denied for user 'root' @ 'localhost' (using password: yes)
The mixlab editing team is recruiting teammates~~
TCP擁塞控制詳解 | 3. 設計空間
Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day
NSQ源码安装运行过程
什么是质押池,如何进行质押呢?
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
探索Cassandra的去中心化分布式架构
随机推荐
QT serial port UI design and solution to display Chinese garbled code
Uploads labs range (with source code analysis) (under update)
Characteristic polynomial and constant coefficient homogeneous linear recurrence
Construction practice camp - graduation summary of phase 6
Golang 匿名函数使用
初试scikit-learn库
Why does the std:: string operation perform poorly- Why do std::string operations perform poorly?
跟我学企业级flutter项目:简化框架demo参考
Multithread 02 thread join
MySQL single table field duplicate data takes the latest SQL statement
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
Register in PHP_ Globals parameter settings
Learn from me about the enterprise flutter project: simplified framework demo reference
Golang decorator mode and its use in NSQ
[combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
《天天数学》连载56:二月二十五日
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
Cocos Creator 2. X automatic packaging (build + compile)
Stm32f103c8t6 firmware library lighting
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)