开发者

convert php array to array [closed]

开发者 https://www.devze.com 2023-04-10 05:11 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_运维百科
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

精彩评论

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