- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$re = '/^--\w+$/m';
$str = '--0000000000000fb2ad0575bf8f28
Content-Type: text/plain; charset="UTF-8"
<body>
Content.
</body>
--0000000000000fb2ad0575bf8f28
Content-Type: text/html; charset="UTF-8"
<div dir="ltr"><body><br>Content.<br></body></div>
--0000000000000fb2ad0575bf8f28--';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);