简体   繁体   English

如何破坏数组索引?

[英]How to implode array indexes?

Is it possible to implode array's indexes? 是否有可能破坏数组的索引? A function is returning me an array and what I need are the indexes of that array so I want to implode only inexes with comma or any other character for my db work 一个函数正在返回一个数组,我需要的是该数组的索引,所以我想只用逗号或任何其他字符来破坏我的数据库工作

You mean something like this... 你的意思是这样的......

implode(',', array_keys($some_arr));

... right? ... 对? ) Here's documentation for array_keys ; 这是array_keys文档 ; in short, when called with a single argument (an array), this function just returns all its keys (as array). 简而言之,当使用单个参数(数组)调用时,此函数只返回其所有键(作为数组)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM