$newsyids=1,3,5,8,7,5,3
$arr1= array($newsyids);
print_r($arr1);
$arr2= array(1,3,5,8,7,5,3);
print_r($arr2);
为什么这两个的打印结果不一样?
请高人指点?
打印arr1的情况是Array ( [0] => 1,3,5,8,7,5,3 )
打印arr2的啥情况是Array ( [0] => 1 [1] => 3 [2] => 5 [3] => 8 [4] => 7 [5] => 5 [6] => 3 )
我想arr1里面的是变量,同时打印结果钥匙arr2的样子,有啥办法吗?
//因为第一个你多加了个array()使得其变为了二维数组$newsyids='1,3,5,8,7,5,3';print_r(explode(",",$newsyids));
//因为第一个你多加了个array()使得其变为了二维数组$newsyids='1,3,5,8,7,5,3';print_r(explode(",",$newsyids));
如二楼,有引号,就是字符串,一个整体,构建array当然只有一个值。
//因为第一个你多加了个array()使得其变为了二维数组$newsyids='1,3,5,8,7,5,3';print_r(explode(",",$newsyids));