Baseball Posted December 22, 2009 Share Posted December 22, 2009 MY JAVASCRIPT PARSES THIS CODE: 1:0,1,0;6:0,2,0;7:0,3,0;8:0,4,0;9:0,5,0;3:1,1,0;4:1,25,0;2:2,1,0;5:2,2,0 BUT I NEED PHP TO PARSE IT INTO THIS: {1:[0,1,0,0,0,0],6:[0,2,0,1,1,1],7:[0,3,0,1,1,1],8:[0,4,0,1,1,1],9:[0,5,0,1,1,1],5:[0,6,0,1,1,1],3:[1,1,0,1,0,1],4:[1,2,0,1,0,1],2:[2,1,0,0,0,0]} WITH THE ['s and { beggining at END } Please help me on HOW IN THE EARTH I WOULD GO ABOUT DOING THIS. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 22, 2009 Share Posted December 22, 2009 this code should help <?php $str = '1:0,1,0;6:0,2,0;7:0,3,0;8:0,4,0;9:0,5,0;3:1,1,0;4:1,25,0;2:2,1,0;5:2,2,0'; $str = str_replace(';',',',preg_replace("#(\d{1,2})[^;]+)#", "$1:[$2]", $str)); print $str; ?> Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted December 22, 2009 Share Posted December 22, 2009 YOUR SHIFT KEY SEEMS TO BE STUCK. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 22, 2009 Share Posted December 22, 2009 YOUR SHIFT KEY SEEMS TO BE STUCK. Look who's talking. Quote Link to comment Share on other sites More sharing options...
Baseball Posted December 22, 2009 Author Share Posted December 22, 2009 LOL SOLVED CAUSE I ALREADY FIXED, im making my new forum software screw ipb 1.3 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.