How would I use PHP to extract everything in between [startstring]
and [endstring]
from this string:
[startstring]hello = guys[ends
Try with preg_match_all:
preg_match_all('/\[startstring\](.*?)\[endstring\]/', $input, $matches);
var_dump($matches);
preg_match_all('/\[startstring\](.*?)\[endstring\]/s', $input, $matches);
echo implode(' ', $matches);
preg_match_all('/\[startstring\](.*?)\=(.*?)\[endstring\]/s', $input, $matches);
for ($i = 0; $i < count($matches[1]); $i++) {
$key = $matches[1][$i];
$value = $matches[2][$i];
$$key = $value;
}