Tonic-_- Posted July 15, 2009 Share Posted July 15, 2009 Well I want to sort of reverse a string without actually reversing it. I want to show it backwards... Example: High Result: ghHi or something like that, i'm not looking for the strrev function because it does the opposite of what I wanted to do... (noob..) Like I want to reverse it backwards in bytes High Bytes: Hi, gh Quote Link to comment Share on other sites More sharing options...
joel24 Posted July 15, 2009 Share Posted July 15, 2009 you can split the string up into an array then reverse each element of the array then implode back into a string... $string = "this is a test string!"; $array = str_split($string, 2); foreach ($array as $key => $value) { $array[$key] = strrev($value); } //you can leave as an array or implode back into a string $string = implode($array); Quote Link to comment Share on other sites More sharing options...
Tonic-_- Posted July 15, 2009 Author Share Posted July 15, 2009 That's kind of what I was thinking I was going to have to do so i'll give it a try and reply back on results. EDIT: Thanks, got it to work with the rest of the code, works perfect. 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.