is there a way in php to have a combined preg_match_all and preg_replace?
Having a string $string like:
Lorem Ipsum `code block` lorem `code`
I want to remove the code blocks from the string and keep $string (without the code blocks) but also keep an array of matches, like I would get with preg_mach_all.
[
0 => `code block`,
1 => `code`
]
Is this possible in one command in php?