$string = "[john] sometext [rohn] sometext [mohan]";
How to get the data between square brackets each in different array.
I have below code
preg_match_all("/\((?:[^()]|(?R))+\)/", $string , $matches);
above code works perfect for curly bracket in the way i need, but how to make it work for square brackets?