当前位置:网站首页>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;边栏推荐
- [oiclass] chess piece
- C console format code
- 2022 underground coal mine electrical test and underground coal mine electrical simulation test
- O & M (21) make winpe startup USB flash disk
- FDA mail security solution
- Global and Chinese market of Kanban software 2022-2028: Research Report on technology, participants, trends, market size and share
- Study diary: February 15, 2022
- 福利抽奖 | 开源企业级监控Zabbix6.0都有哪些亮点
- 多卡服务器使用
- Azure developer news flash list of events of developers in June
猜你喜欢

Raki's notes on reading paper: Leveraging type descriptions for zero shot named entity recognition and classification

Mysql表数据比较大情况下怎么修改添加字段

Linear algebra Chapter 4 Summary of knowledge points of linear equations (Jeff's self perception)

HTA introductory basic tutorial | GUI interface of vbs script HTA concise tutorial, with complete course and interface beautification

FDA ESG regulation: digital certificate must be used to ensure communication security

JMeter obtains cookies across thread groups or JMeter thread groups share cookies

Ffmpeg source code

Pytorch学习(二)

How to use vant to realize data paging and drop-down loading

Recursion frog jumping steps problem
随机推荐
模板参数包和函数参数包
Cmake tutorial series -02- generating binaries using cmake code
Unity TimeLine 数据绑定
O & M (21) make winpe startup USB flash disk
迅为恩智浦iTOP-IMX6开发平台
Global and Chinese market for defense network security 2022-2028: Research Report on technology, participants, trends, market size and share
shell统计某个字符串最后一次出现的位置之前的所有字符串
How to prevent phishing emails? S/mime mail certificate
可视化HTA窗体设计器-HtaMaker 界面介绍及使用方法,下载 | HTA VBS可视化脚本编写
Wechat applet page Jump and parameter transfer
How vscode debugs into standard library files / third-party package source code
O & M (20) make and start USB flash disk and install win10
Matlab code running tutorial (how to run the downloaded code)
Jvxetable增加自定义按钮
2022护网行动在即,关于护网的那些事儿
最小栈详解
NLP text summary: data set introduction and preprocessing [New York Times annotated corpus]
CMake教程系列-02-使用cmake代碼生成二進制
CMake教程系列-04-编译相关函数
在php中字符串的概念是什么