php中清除数组的某个单元_PHP教程

WBOY
Release: 2016-07-12 09:05:00
Original
788 people have browsed it

php中清除数组的某个单元

php中清除数组的某个单元要用unset(),不能用其他方式,例子如下:
<?php
$stu[0]="张三";
$stu[1]="李四";
$stu[2]="王五";
//清除李四这个单元
//$stu[1]=null;//赋值null结果不行
//$stu[1]=&#39;&#39;;//赋值空字符串结果也不行,空字符串也是一个值
//$stu[1]=false;//赋值bool值false结果也不行
unset($stu[1]);
print_r($stu);
Copy after login

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1070926.htmlTechArticlephp中清除数组的某个单元 php中清除数组的某个单元要用unset(),不能用其他方式,例子如下:?php$stu[0]=张三;$stu[1]=李四;$stu[2]=王五;//清除李四...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!