I have a problem with preg_match_all that maybe you can help.
I have a string with some php code in it. I want to retrieve the code that is between the <?php ?> but it does not seem to be working. I am testing the rule with JS and it works properly but in PHP it doesn’t.
This is my code, maybe you can spot something I am missing:
$contents = "<?php
echo 'my test';
?>
<b>This is html text </b>";
echo preg_match_all('/(<\?php).+(\?>)/', $contents, $code);
Thanks in advance,
Denis R.
It may have been that
.did not match line breaks without thesmodifier.