当前位置:网站首页>PHP quickly raises a value in a two-dimensional array to an array key value, array_ The wonderful use of column
PHP quickly raises a value in a two-dimensional array to an array key value, array_ The wonderful use of column
2022-04-22 04:49:00 【Day____ Day____ Up】
Take a chestnut :
// Suppose there is an array as follows
$arr = [
[
'id' => '100',
'name' => 'boy',
'val' => 'handsome',
],
[
'id' => '200',
'name' => 'girl',
'val' => 'beautiful',
],
];
// Expect to name Raise as key value , The operation is as follows
$re = array_column($arr, null, 'name');
print_r($re); // give the result as follows
[
'boy' => [
'id' => '100',
'name' => 'boy',
'val' => 'handsome',
],
'girl' => [
'id' => '200',
'name' => 'girl',
'val' => 'beautiful',
],
];
There are other applications of this function. See : https://www.php.net/manual/zh/function.array-column.php
版权声明
本文为[Day____ Day____ Up]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210758106277.html
边栏推荐
- 2022t elevator repair test exercises and online simulation test
- 【板栗糖GIS】arcmap—模型构造器—批量裁剪栅格数据
- 2022 question bank and answers of Shandong Province safety officer C certificate special operation certificate examination
- 使用指定显卡
- Carina's foundation and birth background | deeply understand the first issue of carina series
- 2022A特种设备相关管理(电梯)考试题模拟考试题库模拟考试平台操作
- [SQL Server accelerated path] database and table (II)
- 不同品牌设备如何兼容实现互联?一文教你看懂
- 2022p cylinder filling test question bank and simulation test
- 【Selenium】Yaml数据驱动
猜你喜欢

2022a special equipment related management (elevator) test question simulation test question bank simulation test platform operation
![[selenium] basic application of unittest testing framework](/img/17/b3d25b9eebccab37128e08bab4bd66.png)
[selenium] basic application of unittest testing framework

First knowledge of UI automation (inspect.exe + uiautomation)

goland汉化解决方法(下载插件失败的情况下)

rsync概述

安装opencv时遇到的报错

Queue II

CommDGI: Community detection oriented deep graph infomax 2020 CIKM

【板栗糖GIS】arcmap—如何制作带缓冲区的图幅结合表

Thesis reading (47): dtfd-mil: double tier feature interpretation multiple instance learning for histopathology
随机推荐
15. Bufferevent client test connection server
【板栗糖GIS】arcmap—如何制作带缓冲区的图幅结合表
rpc error: code = Unavailable desc = error reading from server: EOF
[chestnut sugar GIS] ArcMap - how to combine multiple images into one
Data segmentation in training set tuning
cv2.drawContours()、cv2.findContours()、cv2.boundingRect(img)函数用法解析
10. Libevent receives and processes server messages
[untitled] timed
STL的unique函数返回值
JVM - G1 garbage collector
LeetCode 剑指 Offer 43. 1~n 整数中 1 出现的次数***
13.bufferevent接受和发送数据
C language simple [stack and queue] (bracket matching problem)
C-随手写10
The website is linked to the gambling dark chain
【板栗糖GIS】arcmap—如何将多张影像合并成一张
【Selenium】UnitTest测试框架的基本应用
Leetcode refers to offer 18 Delete the node of the linked list
Leetcode sword finger offer 15 Number of 1 in binary
6. Comparable to JMeter Net pressure measurement tool - crank practical chapter - collecting diagnosis tracking information and how to analyze bottlenecks