Monkuar Posted January 25, 2012 Share Posted January 25, 2012 30|24|17,5|4|20,15|13|33,15|22|33,9|20|22 Let's say my output is that, Realistically every 3numbers is 1 Ticket they are seperated by a "," (comma) I want to wrap parenthesis around them so the output would look like this (30|24|17) (5|4|20) (15|13|33) (15|22|33) (9|20|22) Now would I have to use regex.. or not cuz regex is extremely difficult Thanks :confused: Quote Link to comment https://forums.phpfreaks.com/topic/255728-wrap-brackets-around-every-comma/ Share on other sites More sharing options...
dzelenika Posted January 25, 2012 Share Posted January 25, 2012 $output = "30|24|17,5|4|20,15|13|33,15|22|33,9|20|22"; $string = "(" . str_replace(",", ") (", $output) . ")"; Quote Link to comment https://forums.phpfreaks.com/topic/255728-wrap-brackets-around-every-comma/#findComment-1310933 Share on other sites More sharing options...
Monkuar Posted January 25, 2012 Author Share Posted January 25, 2012 $output = "30|24|17,5|4|20,15|13|33,15|22|33,9|20|22"; $string = "(" . str_replace(",", ") (", $output) . ")"; OKAY OKAY THANK YOU! Im making as RESOLVED! God bless! /wish u had a //comments on it to help Quote Link to comment https://forums.phpfreaks.com/topic/255728-wrap-brackets-around-every-comma/#findComment-1310934 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.