3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = <<<TEXT [Beginning] ABC [Ending] [Beginning] DEF [Ending] [Beginning] GHI [Ending] [Beginning] JKL [Ending] [Beginning] MNO [Ending] TEXT; preg_match_all('/^' . preg_quote('[Beginning]') . '[\r\n]+(.*)[\r\n]+' . preg_quote('[Ending]') . '$/m', $string, $matches); print_r($matches);
Output for 5.6.0 - 5.6.30, hhvm-3.12.14 - 3.17.3, 7.0.0 - 7.2.6
Array ( [0] => Array ( [0] => [Beginning] ABC [Ending] [1] => [Beginning] DEF [Ending] [2] => [Beginning] GHI [Ending] [3] => [Beginning] JKL [Ending] [4] => [Beginning] MNO [Ending] ) [1] => Array ( [0] => ABC [1] => DEF [2] => GHI [3] => JKL [4] => MNO ) )