t_k_eoh Posted July 26, 2007 Share Posted July 26, 2007 Hi all, Sorry for my previous posting but I would like to know how to convert a sentence into strings Eg. "I am just a beginner in this PHP" into new lines as follows I am just a beginner in this PHP Pls help. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 26, 2007 Share Posted July 26, 2007 <?php $word="I am just a beginner in this PHP"; $x=explode(' ',$word); print_r($x); ?> <?php $word="I am just a beginner in this PHP"; $x=explode(' ',$word); $word1=$x[0]; $word2=$x[1]; $word3=$x[2]; $word4=$x[3]; $word5=$x[4]; $word6=$x[5]; $word7=$x[6]; $word8=$x[7]; echo $word2; ?> Quote Link to comment Share on other sites More sharing options...
DeadEvil Posted July 26, 2007 Share Posted July 26, 2007 <?php $word="I am just a beginner in this PHP"; $x=explode(' ',$word); $word = ""; $word.=$x[0]."<br>"; $word.=$x[1]."<br>"; $word.=$x[2]."<br>"; $word.=$x[3]."<br>"; $word.=$x[4]."<br>"; $word.=$x[5]."<br>"; $word.=$x[6]."<br>"; $word.=$x[7]."<br>"; echo $word; ?> Huh .. 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.