[Solved] How to I can split match letter in string PHP


Try this;

>>> $string = 'ABCCDF[GH]IJJ[KLM]';
=> "ABCCDF[GH]IJJ[KLM]"
>>> preg_match_all('/\[(\w+)\]/', $string, $matches);
=> 2

$matches will look like below.

   [
     [
       "[GH]",
       "[KLM]",
     ],
     [
       "GH",
       "KLM",
     ],
   ]

2

solved How to I can split match letter in string PHP