Answer the question
In order to leave comments, you need to log in
How to select value in curly brackets?
There is a line
Text text {FOO} text text {BAR} texthow to select a value from curly braces to get an array of the form
['FOO', 'BAR']
Answer the question
In order to leave comments, you need to log in
$text = 'Text text {FOO} text text {BAR} text';
if(preg_match_all('/\{(.*?)\}/', $text, $matches)) {
print_r($matches[1]);
exit;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question