PHP commonly used array manipulation functions
We have many elements that operate on arrays, let’s talk about some of them first in this section. In 6.3 we will summarize more common array functions.
The following functions are mainly used to move the array pointer and push in and pop out array elements.
array_shift
##mixed array_shift ( array &$array )
array_unshift
int array_unshift (array &$array, mixed $value 1 [, mixed $... ] )
array_pop
mixed array_pop (array &$array)
array_push
Function: Push one or more elements to the end of the index array, and return the total number.
'; print_r($mingren); ?>
Execution result:
The functions of these functions have been explained very clearly. We demonstrate through code:
||
'永远', 'dbg'=>'需要不断奋进', 'djn'=>'才能开创未来' ); //读取数组的值 echo current($t).'
'; //读取数组的键 echo key($t).'
'; //向后移动一下 next($t); //再读值和键 echo current($t).'
'; echo key($t).'
'; //向后移动一下 next($t); echo current($t).'
'; echo key($t).'
'; //向前移动一下 prev($t); echo current($t).'
'; echo key($t).'
'; //移到末尾 end($t); echo current($t).'
'; echo key($t).'
'; //移至开始处 reset($t); echo current($t).'
'; echo key($t).'
'; //销毁数组 unset($t); var_dump($t); ?>
'; //读取数组的键 echo key($t).'
'; //向后移动一下 next($t); //再读值和键 echo current($t).'
'; echo key($t).'
'; //向后移动一下 next($t); echo current($t).'
'; echo key($t).'
'; //向前移动一下 prev($t); echo current($t).'
'; echo key($t).'
'; //移到末尾 end($t); echo current($t).'
'; echo key($t).'
'; //移至开始处 reset($t); echo current($t).'
'; echo key($t).'
'; //销毁数组 unset($t); var_dump($t); ?>
- Course Recommendations
- Courseware download
-
IntermediateFront-end Vue3 actual combat [handwritten vue project]
2857 people are watching -
ElementaryAPIPOST tutorial [Popularization of technical concepts related to network communication]
1795 people are watching -
IntermediateIssue 22_Comprehensive actual combat
5521 people are watching -
ElementaryIssue 22_PHP Programming
5172 people are watching -
ElementaryIssue 22_Front-end development
8713 people are watching -
IntermediateBig data (MySQL) video tutorial full version
4525 people are watching -
ElementaryGo language tutorial-full of practical information and no nonsense
2794 people are watching -
ElementaryGO Language Core Programming Course
2814 people are watching -
IntermediateJS advanced and BootStrap learning
2563 people are watching -
IntermediateSQL optimization and troubleshooting (MySQL version)
3374 people are watching -
IntermediateRedis+MySQL database interview tutorial
2963 people are watching -
ElementaryDeliver food or learn programming?
5708 people are watching
The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~
Students who have watched this course are also learning
- Let's briefly talk about starting a business in PHP
- Quick introduction to web front-end development
- Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
- Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
- Login verification and classic message board
- Computer network knowledge collection
- Quick Start Node.JS Full Version
- The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
- Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
- About us Disclaimer Sitemap
- php.cn:Public welfare online PHP training,Help PHP learners grow quickly!
Function | Function |
---|---|
Pop array The first element in | |
Push the element at the beginning of the array | |
Push elements to the end of the array | |
Pop the last element at the end of the array | |
Read the value of the current position of the pointer | |
Read the key of the current position of the pointer | |
Move the pointer down | |
Move up | |
Pointer to the beginning | |
Pointer to the end |