Mouse Posted October 26, 2006 Share Posted October 26, 2006 Hello… quick question, I need to know how to build a simple form that I put text into and it will spit it out reversed… i.e. I put in “Hello!” It will return “!olleH” any answers?Mouse Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/ Share on other sites More sharing options...
kenrbnsn Posted October 26, 2006 Share Posted October 26, 2006 Use the function [url=http://www.php.net/strrev]strrev()[/url]Ken Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115023 Share on other sites More sharing options...
Mouse Posted October 26, 2006 Author Share Posted October 26, 2006 another unknown function... many thanks... Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115026 Share on other sites More sharing options...
kenrbnsn Posted October 26, 2006 Share Posted October 26, 2006 I recommend looking through the documentation on php.net. You don't have to memorize it, but if you look at the names of the functions, you might be able to figure out which function you need without asking.Ken Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115033 Share on other sites More sharing options...
Mouse Posted October 26, 2006 Author Share Posted October 26, 2006 I have been using a language filter to add tooltips (informative mousovers) to my site but I had an issue with the filter finding keywords within the added mousover script… erm… a little clearer? Well if I used “Duck” as a keyword and then I put the phrase “Donald Duck” into the mouesover explanation the function died so I tried this…I reversed all the content with[code]<?php$outputtext = strrev($inputtext);echo $outputtext?>[/code]So “Donald ‘Fauntleroy’ Duck He usually wears a sailor shirt and cap — but no pants (except when he goes swimming). Although usually easygoing, Donald's most famous trait is his short and often explosive temper. Donald's famous voice, and semi-intelligible is one of the most identifiable voices in the world” Became “dlrow eht ni seciov elbaifitnedi tsom eht fo eno si elbigilletni-imes dna ,eciov suomaf sdlanoD .repmet evisolpxe netfo dna trohs sih si tiart suomaf tsom sdlanoD ,gniogysae yllausu hguohtlA .)gnimmiws seog eh nehw tpecxe( stnap on tub — pac dna trihs rolias a sraew yllausu eH kcuD yoreltnuaF dlanoD”then I used a little CSS to put it right again…[code].backwards {unicode-bidi:bidi-override; direction: rtl;}[/code]Well I thought so… but have a look for yourself what happens… http://mouse.nodstrum.com/backwards.phpAny ideas??? PleaseMouse Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115059 Share on other sites More sharing options...
Psycho Posted October 26, 2006 Share Posted October 26, 2006 It's the CSS code that is doing that. Those CSS properties are meant to display languages that should go from right-to-left & bottom-to-top.I think you need to find another approach. Perhaps serializing the value? Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115121 Share on other sites More sharing options...
Skatecrazy1 Posted October 27, 2006 Share Posted October 27, 2006 just strrev the backwards text....and yes, unicode-bidi is used for languages that read right to left. nothing to do with backwards text. Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115169 Share on other sites More sharing options...
Mouse Posted October 27, 2006 Author Share Posted October 27, 2006 Oh well seemed like such a good idea... at the time!many thanksMouse Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115256 Share on other sites More sharing options...
Mouse Posted October 27, 2006 Author Share Posted October 27, 2006 [quote author=mjdamato link=topic=112850.msg458319#msg458319 date=1161903613]I think you need to find another approach. Perhaps serializing the value?[/quote]so what were you thinking? i didn't get what you meant... Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115257 Share on other sites More sharing options...
redarrow Posted October 27, 2006 Share Posted October 27, 2006 mouse you sure that the .js file your using issint gone dead i think a re install ha. Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115259 Share on other sites More sharing options...
Mouse Posted October 27, 2006 Author Share Posted October 27, 2006 thinking about it, now that i am at work and away from my PHP machine would [code]<?php echo strrev (txet yM); ?> work in the JavaScript/CSS tag???[/code]Mouse Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115271 Share on other sites More sharing options...
Mouse Posted October 27, 2006 Author Share Posted October 27, 2006 [quote author=redarrow link=topic=112850.msg458457#msg458457 date=1161932807]mouse you sure that the .js file your using issint gone dead i think a re install ha.[/quote]Works for me... Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115273 Share on other sites More sharing options...
redarrow Posted October 27, 2006 Share Posted October 27, 2006 This works fine[code]<?php echo strrev ("txet yM"); ?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115275 Share on other sites More sharing options...
Mouse Posted October 27, 2006 Author Share Posted October 27, 2006 many thanks Quote Link to comment https://forums.phpfreaks.com/topic/25229-reversing-text/#findComment-115277 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.