Array merging problem $ act_arr & nbsp ;=& nbsp; array (0 = & gt; 'AAA', 2 = & gt; 'BBB '); I want to change it to the following string 'AAA' and 'BBB 'using implode (', ', $ act_arr). The result is aaa. how can I use the quick method of bbb? it is best not to traverse it, real array merging
$ Act_arr = array (0 => 'AAA', 2 => 'BBB ');
I want to convert it into the following string
'AAA', 'BBB'
Use implode (',', $ act_arr );
The result is aaa, bbb.
How to use the quick method, it is best not to traverse, to achieve the effect I want.
Share To: 'AAA', 2 => 'BBB '); I want to change to the following string 'AAA', 'BBB' using implode (',', $ act_arr ); the result is aaa... 'data-pics = ''>
------ Solution --------------------
This is true.
Echo "'". implode ("', '", $ act_arr )."'";
------ Solution --------------------
Also come to
$ Act_arr = array (0 => 'AAA', 2 => 'BBB ');
$ Act_arr = array_map ('foo', $ act_arr );
Function foo ($ v ){
Return "'$ V '";
}
Echo implode (',', $ act_arr );