thyscorpion Posted July 26, 2006 Share Posted July 26, 2006 hi i have a string variable say [b]"alpha beta gama"[/b]and i need to change it to [b]"alpha-beta-gama.txt" [/b] using php.. which set of functions will help me achieve that? ???i need to fill the spaces with a '-' and put a .txt at the end. :-\ Link to comment https://forums.phpfreaks.com/topic/15665-change-string-in-php-fill-spaces/ Share on other sites More sharing options...
zq29 Posted July 26, 2006 Share Posted July 26, 2006 [code]<?php$str = "alpha beta gama";$new = str_replace(" ","-",$str).".txt";?>[/code] Link to comment https://forums.phpfreaks.com/topic/15665-change-string-in-php-fill-spaces/#findComment-63882 Share on other sites More sharing options...
redarrow Posted July 26, 2006 Share Posted July 26, 2006 Incase you dont understand caternation's[code]$str = "alpha beta gama";$new = str_replace("alpha beta gama","alpha-beta-gama.txt",$str);echo $new;[/code] Link to comment https://forums.phpfreaks.com/topic/15665-change-string-in-php-fill-spaces/#findComment-63892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.