lynxus Posted July 7, 2010 Share Posted July 7, 2010 Hi Guys, Lets say i have: $nums = "70,60,50,40,30,20,10"; How can i somehow invert it so it reads: $nums = "10,20,30,40,50,60,70"; I hope someone can help, Its driving me crazy. Quote Link to comment https://forums.phpfreaks.com/topic/206973-how-to-invert-swap-round-a-string/ Share on other sites More sharing options...
bh Posted July 7, 2010 Share Posted July 7, 2010 Hi, First explode your $nums variable with explode function. And then array_reverse function will be solved your problem. but dont you tought any sorting algorithm ? (it will be more beautiful) Quote Link to comment https://forums.phpfreaks.com/topic/206973-how-to-invert-swap-round-a-string/#findComment-1082300 Share on other sites More sharing options...
lynxus Posted July 7, 2010 Author Share Posted July 7, 2010 TY, i will give it a try, seems sensible. Thanks G Quote Link to comment https://forums.phpfreaks.com/topic/206973-how-to-invert-swap-round-a-string/#findComment-1082303 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.