当前位置:网站首页>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
边栏推荐
- Detailed explanation of gzip and gunzip decompression parameters
- 【现代电子装联期末复习要点】
- The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
- MySQL - execution process of MySQL query statement
- js正则判断域名或者IP的端口路径是否正确
- 安装Redis并部署Redis高可用集群
- Install redis and deploy redis high availability cluster
- PS为图片添加纹理
- ES常用查询、排序、聚合语句
- The first line and the last two lines are frozen when paging
猜你喜欢

R语言中绘制ROC曲线方法二:pROC包

第九天 static 抽象类 接口

C language self compiled string processing function - string segmentation, string filling, etc

Research and Practice on business system migration of a government cloud project

New developments: new trends in cooperation between smartmesh and meshbox

Force buckle - 198 raid homes and plunder houses

Change the icon size of PLSQL toolbar

Groupby use of spark operator

C语言自编字符串处理函数——字符串分割、字符串填充等

299. 猜数字游戏
随机推荐
基于GPU实例的Nanopore数据预处理
Day (7) of picking up matlab
JS regular determines whether the port path of the domain name or IP is correct
七朋元视界可信元宇宙社交体系满足多元化的消费以及社交需求
Cloud migration practice in the financial industry Ping An financial cloud integrates hypermotion cloud migration solution to provide migration services for customers in the financial industry
第九天 static 抽象类 接口
Day (10) of picking up matlab
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
Jour (9) de ramassage de MATLAB
Gartner predicts that the scale of cloud migration will increase significantly; What are the advantages of cloud migration?
JIRA screenshot
实现缺省页面
Install MySQL on MAC
Leetcode-396 rotation function
What is the experience of using prophet, an open source research tool?
欣旺达:HEV和BEV超快充拳头产品大规模出货
Function summary of drawing object arrangement in R language
Day (3) of picking up matlab
糖尿病眼底病变综述概要记录
Implement default page