3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'word1&word2 !word3 word4 &word5'; var_export( preg_split('/ |(?=[&!])/', $string, 0, PREG_SPLIT_NO_EMPTY) );

preferences:
55.93 ms | 1280 KiB | 5 Q