久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

PHP刪除數組的第一個索引并重新索引

PHP remove the first index of an array and re-index(PHP刪除數組的第一個索引并重新索引)
本文介紹了PHP刪除數組的第一個索引并重新索引的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我有一個像數組

<代碼>([0] =>一個[2] =>乙[4] =>C[6] =>D)

我想刪除第一個元素,然后重新索引數組以獲得輸出

<代碼>([0] =>乙[1] =>C[2] =>D)

我需要使用哪個 PHP 函數?

<小時>

更新

輸入數組是

數組([0] =>大批([0] =>一些不需要的文字[1] =>你瘋了)[2] =>大批([0] =>我下面的文字[1] =>你瘋了)[10] =>大批([0] =>我愛的名言[1] =>你瘋了))

輸出應該像

數組([0] =>大批([0] =>我下面的文字[1] =>你瘋了)[1] =>大批([0] =>我愛的名言[1] =>你瘋了))

解決方案

With array_splice.

http://www.php.net/manual/en/function.array-splice.php

<前>php > print_r($input);大批([0] => A[2] => B[4] => C[6] => D)php > array_splice($input, 0, 1);php > print_r($input);大批([0] => B[1] => C[2] => D)

I have an array like Array

(
    [0] => A
    [2] => B
    [4] => C
    [6] => D
)

I want to remove the first element and then re-index array to get the output

(
    [0] => B
    [1] => C
    [2] => D
)

Which PHP function i need to use?


Update

Input array is

Array
(
    [0] => Array
        (
            [0] => Some Unwanted text
            [1] => You crazyy
        )

    [2] => Array
        (
            [0] => My belowed text
            [1] => You crazyy
        )

    [10] => Array
        (
            [0] => My loved quote
            [1] => You crazyy
        )

)

And the output should be like

Array
(
    [0] => Array
        (
            [0] => My belowed text
            [1] => You crazyy
        )

    [1] => Array
        (
            [0] => My loved quote
            [1] => You crazyy
        )

)

解決方案

With array_splice.

http://www.php.net/manual/en/function.array-splice.php

php > print_r($input);
Array
(
    [0] => A
    [2] => B
    [4] => C
    [6] => D
)
php > array_splice($input, 0, 1);
php > print_r($input);
Array
(
    [0] => B
    [1] => C
    [2] => D
)

這篇關于PHP刪除數組的第一個索引并重新索引的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: www五月天| 久久午夜精品 | 亚洲午夜久久 | av色婷婷 | 97色综合 | 成人伊人网 | 中文字幕黄色 | 亚洲午夜久久久 | 一级肉体全黄裸片 | 国产一级片免费 | 午夜aaa| 天天天天天操 | 日韩专区中文字幕 | 日韩精品一区在线观看 | 日韩欧美中文在线 | 五月婷色| 日本欧美久久久久免费播放网 | a级片在线观看 | 网站av | 一区二区中文 | 一级黄色大片 | 精品国产91乱码一区二区三区 | 日韩专区中文字幕 | 男人午夜影院 | 九九精品在线视频 | 求av网址| 日本在线免费视频 | 日本a网站| 国产在线天堂 | 国产精品久久久一区二区三区 | 日韩精品在线一区二区 | 中文字幕一区二区在线播放 | 日本国产欧美 | 中文在线观看视频 | 国产精品99久久久久久久久久久久 | 在线播放日韩 | 又色又爽又黄gif动态图 | 日韩欧美精品一区 | 999毛片| 在线观看国产小视频 | 免费日韩av |