Split two groups of data into strings and separate the php array characters with commas (,).
Array
(
[0] => Array
(
[Mobile] = & gt; 13814002394
)
[1] => Array
(
[Mobile] = & gt; 13814002395
)
[2] => Array
(
[Mobile] = & gt; 13814002396
)
[3] => Array
(
[Mobile] = & gt; 13814002397
)
[4] => Array
(
[Mobile] = & gt; 13814002398
)
[5] => Array
(
[Mobile] = & gt; 13814002399
)
[6] => Array
(
[Mobile] = & gt; 13814002400
)
)
This is a two-group array. I want to split it into strings $ mobile = 13814002399,13814002400, 13814002398;
This is only the form
Reply to discussion (solution)
$ Mobile = join (',', array_map (function ($ v) {return current ($ v) ;}, $ arr );
If PHP version 5.5 still supports array_column ()
There is no answer !!!!!!!!!
$mobile=implode(',',array_map(function($arr){return implode(',',$arr);},$arr));
$array=array('0'=>array('mobile'=>'13814002394'),'1'=>array('mobile'=>'13814002395'), '2'=>array('mobile'=>'13814002396'),'3'=>array('mobile'=>'13814002397'),'4'=>array('mobile'=>'13814002398'),'5'=>array('mobile'=>'13814002399'),'6'=>array('mobile'=>'13814002400'));foreach($array as $key=>$value){$mobile.=$dot.$value['mobile'];$dot=",";}return $mobile;
$array=array('0'=>array('mobile'=>'13814002394'),'1'=>array('mobile'=>'13814002395'), '2'=>array('mobile'=>'13814002396'),'3'=>array('mobile'=>'13814002397'),'4'=>array('mobile'=>'13814002398'),'5'=>array('mobile'=>'13814002399'),'6'=>array('mobile'=>'13814002400'));foreach($array as $key=>$value){$newarray[$key]=$value['mobile'];}return join(",",$newarray);