View Full Version : Add comma between words
10-26-2003, 03: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?
10-26-2003, 03:17 PM
$addcomma = str_replace(" ",", ",$str);
10-27-2003, 04:10 AM
.... or , if you had an array of words ...
$words = array( 'yaks' , 'rule' ) ;
$words = file( 'wordlist.txt' ) ;
$wordstr = implode( ',' , $words ) ;
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.