php移除第一个元素的方法:首先创建一个PHP示例文件;然后定义一个数组;最后通过“array_shift()”函数加while循环不断移除数组的第一个元素即可。
本文操作环境:windows7系统、PHP7.1版,DELL G3电脑
php通过array_shift()函数移除数组第一个元素的方法
下面的代码通过array_shift()函数加while循环不断移除数组的第一个元素,直到数组为空
<?php $alpha = array("a", "b", "c"); while ( count( $alpha ) ) { $val = array_shift( $alpha); print "$val<br />"; print "there are ".count( $alpha )." elements in \$alpha <br />"; } ?>
【推荐学习:《PHP视频教程》】
The above is the detailed content of How to remove the first element in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
