开发者

convert php array to array [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_运维百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 9 years ago.

Improve this question

Lets say I'm having the following php array

Array(
[0]=>a,b,c
)

how can I convert it to get as result another array, what should look like

Array(

[0]=>a

[1]=>b

[2]=>c
)


// $a = array('a,b,c');
$b = explode(',', $a[0])


You can simple use php explode() function for that.explode(",", $somearray[0]);.


This is the way to create index array if you want to give first index of your array whatever you want rather than 0.

Array(
[0]=>'a','b','c'
)

So if you want to start you first index from 10 than.

 Array(
   [10]=>'a','b','c'
 )

will result like this

 Array(
    [10]=>'a',
    [11]=>'b',
    [12]=>'c'
    )
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜