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

取消設置多維數組中的列

Unset a column in a multidimensional array(取消設置多維數組中的列)
本文介紹了取消設置多維數組中的列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有這個數組 $output 看起來像這樣:

I have this array $output which looks like this:

Array(
    [0] => Array(
        [0] => 1a
        [1] => 1b
        [2] => 1c
    )
    [1] => Array(
        [0] => 2a
        [1] => 2b
        [2] => 2c
    )
    [2] => Array(
        [0] => 3a
        [1] => 3b
        [2] => 3c
    )
    [3] => Array(
        [0] => 4a
        [1] => 4b
        [2] => 4c
    )
)

等等...

當我想刪除我只使用的第二個元素時:

When I want to remove the second element I just use:

$output = unset($output[1]);

獲得以下內容:

Array(
    [0] => Array(
        [0] => 1a
        [1] => 1b
        [2] => 1c
    )
    [1] => Array(
        [0] => 3a
        [1] => 3b
        [2] => 3c
    )
    [2] => Array(
        [0] => 4a
        [1] => 4b
        [2] => 4c
    )
)

我的問題是如何刪除數組中每個元素的第二個元素 ([0][1], [1][1], [2][1], [3][1] ,...) 得到以下內容:

My question is how to remove every second element of every element in the array ([0][1], [1][1], [2][1], [3][1] ,...) to get the following:

Array(
    [0] => Array(
        [0] => 1a
        [1] => 1c
    )
    [1] => Array(
        [0] => 2a
        [1] => 2c
    )
    [2] => Array(
        [0] => 3a
        [1] => 3c
    )
    [3] => Array(
        [0] => 4a
        [1] => 4c
    )
)

推薦答案

不能用簡單的命令完成,但可以使用循環:

Can't be done with a simple command, but you can use a loop:

foreach(array_keys($output) as $key) {
   unset($output[$key][1]);
}

這篇關于取消設置多維數組中的列的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 一二三四在线视频观看社区 | 91精品国产91久久久久福利 | 日韩一三区 | 日本中文字幕一区 | 久久综合入口 | 日韩中文字幕 | 中文字幕在线视频精品 | 亚洲免费久久久 | 天天操天天干天天透 | 成人免费视频 | a级免费视频| 久久久久久久一区 | 成人福利视频网站 | 亚洲乱码一区二区三区在线观看 | 亚洲aⅴ | 91在线视频国产 | 羞羞涩涩在线观看 | 日韩久久久久久 | 91免费福利视频 | 久久av一区二区 | 精品视频999 | 中文字幕精品视频 | 成人久久久 | 成人午夜av | 欧美日本在线观看 | 日韩精品在线视频免费观看 | 国产精品久久久久久久岛一牛影视 | 中文字幕亚洲精品 | www.99久久.com | 欧美日韩一本 | 蜜桃免费一区二区三区 | 亚洲精品久久久久中文字幕二区 | 天天干天天草 | 四虎影院新网址 | av喷水 | 午夜视频在线免费观看 | 日本超碰 | 久久久久无码国产精品一区 | 一级看片 | 日日碰狠狠躁久久躁96avv | 91成人免费看片 |