View Full Version : Add comma between words
SDP2006
10-26-2003, 02:08 PM
I have a list of about 50 words I want to put comma between each word. Is there a way to do this automatically with PHP?
Nightfire
10-26-2003, 02:17 PM
$addcomma = str_replace(" ",", ",$str);
firepages
10-27-2003, 03:10 AM
.... or , if you had an array of words ...
<?php
$words = array( 'yaks' , 'rule' ) ;
//or
$words = file( 'wordlist.txt' ) ;
$wordstr = implode( ',' , $words ) ;
?>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.