Separate two groups of data into strings and separate them with commas (,). how can this problem be solved?

Source: Internet
Author: User
Split the two groups of data into strings separated by "," (& nbsp; [0] & nbsp ;=& gt; & nbsp; array & nbsp; (& nbsp; & nbs split the two groups of data into strings as ", separate
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
------ Solution --------------------


$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;


------ Solution --------------------

$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);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.