PHPrev Posted December 14, 2008 Share Posted December 14, 2008 Can someone tell me how to do following For example I have word "house" [without quotes] and I want to make it to looks like this h*o*u*s*e* I want code to insert * in any word I want Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/136939-generating-letters-help/ Share on other sites More sharing options...
wildteen88 Posted December 14, 2008 Share Posted December 14, 2008 $word = 'house'; $newWord = ''; for($i = 0; $i <= strlen($word); $i++) { $newWord .= $word{$i}.'*'; } echo $newWord; Quote Link to comment https://forums.phpfreaks.com/topic/136939-generating-letters-help/#findComment-715210 Share on other sites More sharing options...
Mark Baker Posted December 14, 2008 Share Posted December 14, 2008 $string = 'house'; $string = implode('*',explode($string)); Quote Link to comment https://forums.phpfreaks.com/topic/136939-generating-letters-help/#findComment-715284 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.