首頁 > php教程 > PHP开发 > 主體

php array_slice函數的使用以及參數詳解

高洛峰
發布: 2017-03-18 16:10:24
原創
1541 人瀏覽過

<?php 
/* 
用手册上的例子 
*/ 
$input = array ("a", "b", "c", "d", "e"); 
$output = array_slice ($input, 2); // returns "c", "d", and "e", 
$output = array_slice ($input, 2, -1); // returns "c", "d" 
$output = array_slice ($input, -2, 1); // returns "d" 
$output = array_slice ($input, 0, 3); // returns "a", "b", and "c" 
?>
登入後複製

重點說下length 為負.它表示取數組一直到距離數組末端length這麼遠的距離 

更多php array_slice函數的使用以及參數詳解相關文章請關注PHP中文網!

相關文章:

php數組函數序列之array_slice()

php array_slice 取出數組中的一段序列實例

php中解析

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!