I have String like this
$string ="this is test {username} ,{password@123} and Other {asdfg@#$}"
I want this string as array format as follows
[1] => Array
(
[0] => username
[1] => password@123
[2] => asdfg@#$
)
$re = "/\{(.*?)\}/";
$str = "this is test {username} ,{password@123} and Other {asdfg@#\$}";
preg_match_all($re, $str, $matches);
print_r($matches);
this gives what you want