Blogger Information
Blog 22
fans 1
comment 1
visits 22862
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
array_splice() 增删改查操作
forever浅笑
Original
659 people have browsed it

1、在武汉前添加合肥

实例

<?php
$city = ['重庆', '武汉', '上海', '北京', '郑州','广州'];
array_splice($city,1,0,'合肥');
print_r($city);
echo '<hr>';
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例  

2、删除上海北京  


实例

<?php
$city2 = ['重庆', '武汉', '上海', '北京', '郑州','广州'];
array_splice($city2,2,2);
print_r($city2);
echo '<hr>';
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

3、把北京郑州改为挂林和成都 


实例

<?php
$city3 = ['重庆', '武汉', '上海', '北京', '郑州','广州'];
array_splice($city3,3,2,['挂林','成都']);
print_r($city3);
echo '<hr>';
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

4、获取武汉,上海和北京


实例

<?php
$city4 = ['重庆', '武汉', '上海', '北京', '郑州','广州'];
print_r(array_splice($city4,1,3));
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例



Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post