当前位置:网站首页>Introduction notes to PHP zero Foundation (13): array related functions
Introduction notes to PHP zero Foundation (13): array related functions
2022-04-23 16:14:00 【Peng Shiyu psy】
Array related functions
Custom array print function , Easy to view
Sorting function
according to ASCII Sort code
sort
Yes array By itself (value) Ascending sort .( Subscript rearrangement )
rsort
Yes array By itself (value) null .
asort
Yes array Sort itself in ascending order ( Subscript reserved )
arsort
Yes array Sort itself in descending order
ksort
Yes array Press the button itself (key) Ascending sort .
krsort
Yes array Press the key itself (key) null .
shuffle
Random disruption
Pointer function
reset take array The internal pointer of the array returns to the first cell and returns the value of the first array cell .
end take array The internal pointer to the last cell and returns its value .
next Move the internal pointer in the array one bit forward
prev Returns the internal pointer of an array to one bit
current Returns the current value in the array
key Returns the key name of the current cell in the array .
Be careful :next and prev Move the pointer , May move out of the array , Only through end perhaps reset Reset pointer
Example
Other functions
count Statistical array 、Countable The number of all elements in the object
array_push take array As a stack , And push the incoming variable into array At the end of .
array_pop Pop up and return array The value of the last element
array_shift take array The first cell of is moved out and returned as a result
array_unshift Insert one or more cells at the beginning of an array
data structure
- Stack Pressing stack ,FILO First in, then out
- queue line up ,FIFO fifo
Implementation stack :
- front array_unshift/array_shift
- Back array_push/array_pop
Implementation queue :
- Last in first out array_push/array_shift
- Forward and out array_unshift/array_pop
array_reverse Returns a new array whose cells are in reverse order
in_array Check if there is a value in the array
array_keys Returns some or all key names in the array
array_values return input All values in the array and numerically index them .
版权声明
本文为[Peng Shiyu psy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231521404553.html
边栏推荐
- Using JSON server to create server requests locally
- 捡起MATLAB的第(10)天
- Oak-d raspberry pie cloud project [with detailed code]
- Summary according to classification in sail software
- [section 5 if and for]
- Day (7) of picking up matlab
- Unity shader learning
- C, calculation method and source program of bell number
- Read the meaning of serial port and various level signals
- 451. 根据字符出现频率排序
猜你喜欢
[key points of final review of modern electronic assembly]
安装Redis并部署Redis高可用集群
Government cloud migration practice: Beiming digital division used hypermotion cloud migration products to implement the cloud migration project for a government unit, and completed the migration of n
撿起MATLAB的第(9)天
Read the meaning of serial port and various level signals
What is the experience of using prophet, an open source research tool?
力扣-746.使用最小花费爬楼梯
一文掌握vscode远程gdb调试
Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1
Ice -- source code analysis
随机推荐
What does cloud disaster tolerance mean? What is the difference between cloud disaster tolerance and traditional disaster tolerance?
JS regular determines whether the port path of the domain name or IP is correct
面试题 17.10. 主要元素
保姆级Anaconda安装教程
欣旺达:HEV和BEV超快充拳头产品大规模出货
Detailed explanation of gzip and gunzip decompression parameters
linux上启动oracle服务
Cloudy data flow? Disaster recovery on cloud? Last value content sharing years ago
Day (8) of picking up matlab
ESXi封装网卡驱动
Countdown 1 day ~ 2022 online conference of cloud disaster tolerance products is about to begin
How to conduct application security test (AST)
Meaning and usage of volatile
Filter usage of spark operator
Change the icon size of PLSQL toolbar
Ice -- source code analysis
What is the experience of using prophet, an open source research tool?
Jour (9) de ramassage de MATLAB
捡起MATLAB的第(4)天
The solution of not displaying a whole line when the total value needs to be set to 0 in sail software