sean123 Posted February 14, 2008 Share Posted February 14, 2008 I've got some text that I want putting in order so it is not in 1 line. The text is: username Level: 25 Ratio: 1.54 Rank: 3266 th Kills: 73761 Deaths: 9977 Experience: 674534632 That is generated when the user enters their username. Is it possible to make it in this format? username Level: 25 Ratio: 1.54 Rank: 3266 th Kills: 73761 Deaths: 9977 Experience: 674534632 Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 14, 2008 Share Posted February 14, 2008 <?php $text = "username Level: 25 Ratio: 1.54 Rank: 3266 th Kills: 73761 Deaths: 9977 Experience: 674534632"; $nl = "\n"; //Change to <br /> for HTML print preg_replace("/\s*(\w+:)/","$nl\$1",$text); ?> Quote Link to comment Share on other sites More sharing options...
sean123 Posted February 15, 2008 Author Share Posted February 15, 2008 Thanks 1 more question. I want to put each 1 in a variable and remove anything after the colon so it would be like this: $name = "username"; $level = "25"; $ratio = "1.54"; $rank = "3266 th"; $kill = "73761"; $death = "9977"; $exp = "674534632"; Is it possible? 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.