What is happening is that you are parsing the string which matches and "pulls apart" the outer shortcode. You then need to parse that shortcode's content (array element 5) to parse the two inner shortcodes. count($matches[0][0]) should be 2. Simple is principle but there are a lot of ways it could go wrong. You'd want to do a lot of error checking and may want to iterate over the arrays rather than assuming the first match, $matches[5][0], as I did.