Here's the fix: $words = "put-it-goot-it"; $words = explode('-', $words); foreach($words as &$hword){ $hword = $hword.'ha'; } $word = implode('-', $words); echo $word; Code (markup): Fixed your own code as well: $words = explode('-', $word); $hnewPhrase=''; foreach ($words as $hword) { $hnewPhrase[] = $hword.'ha'; } $hstring = implode('-', $hnewPhrase); $newPhrase[] = $hstring.$punc; Code (markup):
Sorry, it doesn't seem as though this is a problem a little snippet being provided can fix. PM me for a full version of the code.
@ankit_frenz: You just copy pasted his code which doesn't work if you put it inside another for loop. You have to initialize $hnewphrase to empty first.
Oh, I see now, I forgot to empty. PM or reply with your PayPal (dpacmittal) and I'll send over the $5.
Hello Infranight, Have you tried using " if else and while " statements ? I'm sure there are people here more advanced then I, but I don't see any suggestions here for use of " if " " else " and " while " statements. I use them to accomplish similar jobs. I just discovered this forum, so I don't have enough posts to give you a link here for some good help with that. PM me if you want some help with that and I'll give you a link to some really good tutorials. cheers Jeff
He never mentioned that he was using this inside a loop..thats what i was saying that his code was working good..