3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'The quick [begin]brown fox[end] jumps over [begin]the lazy[end] dog.'; $array = preg_split('/\\[begin\\]|\\[end\\]/', $string, -1); print_r($array);

preferences:
117.13 ms | 1484 KiB | 5 Q