9

I have this right now:

$_words = "'".implode("','", $array_of_words)."'";

Which gives me a string like:

'word','word2','word3'

How can I modify that to get

"word","word2","word3"

Thanks

Hommer Smith
  • 26,772
  • 56
  • 167
  • 296

3 Answers3

29

Just swap your quotes

$_words = '"'.implode('","', $array_of_words).'"';
John Conde
  • 217,595
  • 99
  • 455
  • 496
0
$result=array();
foreach ($array_of_words as $a1) {
    $result[]='"'.$a1.'"';
}
$_words = implode( ',', $result );
echo $_words;                   
Harry
  • 87,580
  • 25
  • 202
  • 214
0

$_words = implode( "','", $array_of_words );

Henk van Boeijen
  • 7,357
  • 6
  • 32
  • 42