当前位置:网站首页>PHP two-dimensional array randomly fetches a random or fixed number of one-dimensional arrays
PHP two-dimensional array randomly fetches a random or fixed number of one-dimensional arrays
2022-06-30 02:56:00 【Fox catsup】
$list = [
['id' => 1, 'name' => ' motion '],
['id' => 2, 'name' => ' See a movie ']
['id' => 3, 'name' => ' Play a game '],
['id' => 4, 'name' => ' travel '],
['id' => 5, 'name' => ' self-driving tours '],
['id' => 6, 'name' => ' shopping '],
];
// Get random quantity subscript ,rand(2,6) It can also be replaced by an integer number
$all = array_rand($list, rand(2,6));
$data = [];
foreach ($all as $value) {
$data[] = $list[$value];
}
return $data;
边栏推荐
- Global and Chinese market for defense network security 2022-2028: Research Report on technology, participants, trends, market size and share
- JMeter obtains cookies across thread groups or JMeter thread groups share cookies
- Which is a good foreign exchange trading platform? Is it safe to have regulated funds?
- GTK interface programming (II): key components
- Raki's notes on reading paper: Leveraging type descriptions for zero shot named entity recognition and classification
- 自定义JvxeTable的按钮及备注下$set的用法
- Global and Chinese market of Kanban software 2022-2028: Research Report on technology, participants, trends, market size and share
- Distributed file storage system fastdfs hands on how to do it
- 原生JS怎么生成九宫格
- JvxeTable子表记录加载完毕事件
猜你喜欢
并发请求下如何防重复提交
Unity timeline data binding
Distributed file system fastdfs
Pytoch learning (II)
Recursion frog jumping steps problem
怎么利用Redis实现点赞功能
Customize the buttons of jvxetable and the usage of $set under notes
What is a self signed certificate? Advantages and disadvantages of self signed SSL certificates?
Differences among digicert, SECTIONO and globalsign code signing certificates
What is certificate transparency CT? How to query CT logs certificate logs?
随机推荐
JvxeTable子表记录加载完毕事件
2. < tag dynamic programming and 0-1 knapsack problem > lt.416 Split equal sum subset + lt.1049 Weight of the last stone II
SQLite使用
迅为恩智浦iTOP-IMX6开发平台
Precautions for purchasing wildcard SSL certificate
Global and Chinese market of subscription revenue management software 2022-2028: Research Report on technology, participants, trends, market size and share
Software testing skills, JMeter stress testing tutorial, transaction controller of logic controller (25)
What is certificate transparency CT? How to query CT logs certificate logs?
High paid programmers & interview questions series 63: talk about the differences between sleep (), yield (), join (), and wait ()
Implementation of Sanzi chess with C language
Servlet面试题
2.8 【 weight of complete binary tree 】
重磅来袭--UE5的开源数字孪生解决方案
Cmake tutorial series-03-dependency management
Unity timeline data binding
Azure developer news flash list of events of developers in June
Mysql表数据比较大情况下怎么修改添加字段
RAII内存管理
Lua 基础知识
How to prevent duplicate submission under concurrent requests