gpt4 book ai didi

php - 只想从索引中删除键而不是 php 中的值

转载 作者:行者123 更新时间:2023-12-03 09:23:19 24 4
gpt4 key购买 nike

我在 php 中有数组并将其转换为 json.Now我有 json 格式的代码

{
"2": "12:40 to 13:0",
"3": "13:0 to 13:20",
"4": "13:20 to 13:40",
"5": "13:40 to 14:0",
"6": "14:0 to 14:20",
"7": "14:20 to 14:40",
"8": "14:40 to 15:0",
"9": "15:0 to 15:20",
"10": "15:20 to 15:40",
"11": "15:40 to 16:0",
"12": "16:0 to 16:20",
"13": "16:20 to 16:40",
"14": "16:40 to 17:0",
"15": "17:0 to 17:20",
"16": "17:20 to 17:40",
"17": "17:40 to 18:0"

}json 格式但我想删除索引 2,3,4,5 表单代码并希望数据位于

    {
"12:40 to 13:0",
"13:0 to 13:20",
"13:20 to 13:40",
"13:40 to 14:0",
"14:0 to 14:20",
"14:20 to 14:40",
"14:40 to 15:0",
"15:0 to 15:20",
"15:20 to 15:40",
"15:40 to 16:0",
"16:0 to 16:20",
"16:20 to 16:40",
"16:40 to 17:0",
"17:0 to 17:20",
"17:20 to 17:40",
"17:40 to 18:0"
}

任何帮助:)

最佳答案

array_values .

authoritative资源也:

array_values($array);

关于php - 只想从索引中删除键而不是 php 中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27055838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com