Dragy Posted October 6, 2006 Share Posted October 6, 2006 Hi guys ;)I'm not very knowledgeable with PHP, altough I am editing scripts and fit them into my needs all the time. But right now I need a very specific piece of code, shouldn't be too long, but I have absolute no idea where to start. I got a text variable, lets say $sometext = "blah"; Now what I wanna do is simply flip it, so the final result will be "halb". Now that is step one, but after that I think I'll also include some HTML code in that variable, something like $sometext = "blah <br> blah"; And I gotta flipthe text without flipping the <br>. I'm not sure how complicated it is, but I just need that piece of code and I can't find anything about it.Thanks ! Quote Link to comment Share on other sites More sharing options...
Zane Posted October 6, 2006 Share Posted October 6, 2006 look at the strrev() functionhttp://php.net/strrev Quote Link to comment Share on other sites More sharing options...
printf Posted October 6, 2006 Share Posted October 6, 2006 something like![code]<?php$eol = "\r\n";$text = 'blahblahblah';$text = implode ( $eol, array_map ( 'strrev', explode ( $eol, $text ) ) );echo $text;?>[/code]me! Quote Link to comment Share on other sites More sharing options...
Dragy Posted October 6, 2006 Author Share Posted October 6, 2006 Hi, thanks, the code works, but the post didn't show the < br > and that's what I meant by including HTML code without flipping it, so let's say I'll be able to do"Hi,blah blah blah" (by "Hi, < br > blah blah blah")and not just "Hi, blah blah blah" in one single line Quote Link to comment Share on other sites More sharing options...
Dragy Posted October 6, 2006 Author Share Posted October 6, 2006 OK, I got this working by using printf s code! I just changed the \r \n to <br> and it all worked :)thank you guys 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.