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. Link to comment https://forums.phpfreaks.com/topic/185995-php-convert-help-emerjency/ 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; ?> Link to comment https://forums.phpfreaks.com/topic/185995-php-convert-help-emerjency/#findComment-982154 Share on other sites More sharing options...
Daniel0 Posted December 22, 2009 Share Posted December 22, 2009 YOUR SHIFT KEY SEEMS TO BE STUCK. Link to comment https://forums.phpfreaks.com/topic/185995-php-convert-help-emerjency/#findComment-982168 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. Link to comment https://forums.phpfreaks.com/topic/185995-php-convert-help-emerjency/#findComment-982175 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 Link to comment https://forums.phpfreaks.com/topic/185995-php-convert-help-emerjency/#findComment-982199 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.