Home > Backend Development > PHP Tutorial > Clear a certain unit of an array in php_PHP tutorial

Clear a certain unit of an array in php_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 09:05:00
Original
898 people have browsed it

Clear a certain unit of the array in 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.htmlTechArticleTo clear a certain unit of an array in php, to clear a certain unit of an array in php, you need to use unset(), which cannot be used. Other methods, examples are as follows:?php$stu[0]=Zhang San;$stu[1]=Li Si;$stu[2]=王五;//Clear Li Si...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template