这是我的数组
array(5) {
[0]=>
string(2) "10"
[1]=>
string(2) "22"
[2]=>
string(2) "25"
[3]=>
string(2) "37"
[4]=>
string(2) "38"
}
如何使其像这样排列
array(1) {
[0]=>
string(2) "10"
}
array(2) {
[0]=>
string(2) "22"
}
array(3) {
[0]=>
string(2) "25"
}
array(4) {
[0]=>
string(2) "37"
}
array(5) {
[0]=>
string(2) "38"
}
我正在使用此代码
$sellerIds = * My Array *
if(is_array($sellerIds)){
foreach($sellerIds as $key => $value){
$sellerIds = $value;
}
}
// do something with $sellerIds
但是当我var_dump它时,它就这样
string(2) "10"
string(2) "22"
...
请帮助我!谢谢
答案 0 :(得分:0)
答案 1 :(得分:0)
$array=array("10","22","25","37","38");
$finalArrays=(array_chunk($array, 1,true));
foreach($finalArrays as $value)
{
var_dump($value);
}