3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $contents = "BEGIN_DATA_567 329 ... END_DATA_567 BEGIN_DATA 561 .... END_DATA"; preg_match('/BEGIN_DATA /', $contents, $matches, PREG_OFFSET_CAPTURE); $start = $matches[0][1]; preg_match('/END_DATA$/', $contents, $matches, PREG_OFFSET_CAPTURE); $end = $matches[0][1]; echo $between=substr($contents, $start, $end - $start);
Output for 4.3.0 - 7.1.0
BEGIN_DATA 561 ....