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. :-\ Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.