array_shift2.php
2016-04-20 15:43
525 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> array_shift2.php </title>
<meta charset="UTF-8">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<?php
$stack = array("orange", "banana", "apple", "raspberry");
print_r($stack);
echo "<hr>";
$fruit = array_shift($stack); //删除第一个元素,此时$fruit 变量值为orange
//输出$fruit
echo "\$fruit 的值为:$fruit <hr>";
//查看整个数组结构并查看数组索引变化
print_r($stack);
?>
</body>
</html>
Array ( [0] => orange [1] => banana [2] => apple [3] => raspberry )
$fruit 的值为:orange
Array ( [0] => banana [1] => apple [2] => raspberry )
<html>
<head>
<title> array_shift2.php </title>
<meta charset="UTF-8">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<?php
$stack = array("orange", "banana", "apple", "raspberry");
print_r($stack);
echo "<hr>";
$fruit = array_shift($stack); //删除第一个元素,此时$fruit 变量值为orange
//输出$fruit
echo "\$fruit 的值为:$fruit <hr>";
//查看整个数组结构并查看数组索引变化
print_r($stack);
?>
</body>
</html>
Array ( [0] => orange [1] => banana [2] => apple [3] => raspberry )
$fruit 的值为:orange
Array ( [0] => banana [1] => apple [2] => raspberry )
相关文章推荐
- php题目
- Yii 2.0常用方法记录
- ZipOutputStream中 putNextEntry的作用是什么?
- php Split an Array into N Arrays
- thinkphp单入口和多入口的访问方法
- array_shift.php
- vsftpd 配置:chroot_local_user与chroot_list_enable详解
- 请求php返回json生成自定义对象
- vsftpd cmds_allowed 权限控制
- php要掌握的基本知识
- PHP安全设置
- 数组用php插入mysql数据库
- php 报警 [NOTICE] fpm_children_bury()
- ThinkPHP 3.1.2 模板中的基本语法<2>
- ThinkPHP 3.1.2 模板中的基本语法<2>
- ThinkPHP 3.1.2 模板中的基本语法<2>
- php中header函数参数的Cache-control:private,no-cache,must-revalidate,max-age是使用方法!
- yii2整合百度编辑器umeditor及umeditor图片上传问题的解决办法
- php中怎么实现后台执行?
- 使用thinkphp框架实现登录注册功能