I have a working solution to this already. But, it also has a big flaw. Here is what i have, it is with regex ofcourse:
'preg_match_all("/[{].*[}]/","{SOMETHING BETWEEN BRACKETS}",$codes);'
This is absolutly fine if the string is small, but it does not work for a big string. I know you can set the limit higher in the php.ini with ini_set
. This can cause a php crash if it is too high.
Now i thought of getting the stringpos of 1 char and then the strpos of the other and loop through it. This has the complication if there are more then 1 brackets, and is not that efficient. Is there another way to select a big string between 2 characters?
Check this http://www.php.net/manual/en/pcre.configuration.php
You need increase value of params:
pcre.backtrack_limit
and pcre.recursion_limit
You can modify your regex just to
/{.*?}/