convert php array to array [closed]
开发者_运维百科
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 questionLets 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'
)
精彩评论