3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'Fry me a Beaver. Fry me a Beaver! Fry me a Beaver? Fry me Beaver no. 4?! Fry me many Beavers... End'; var_export( preg_split('~[.?!]+\K\s+(?=[A-Z])~', $str, 0, PREG_SPLIT_NO_EMPTY) );
Output for 7.4.0 - 7.4.32, 8.0.1 - 8.0.24, 8.1.0 - 8.1.11
array ( 0 => 'Fry me a Beaver.', 1 => 'Fry me a Beaver!', 2 => 'Fry me a Beaver?', 3 => 'Fry me Beaver no. 4?!', 4 => 'Fry me many Beavers...', 5 => 'End', )

preferences:
25.67 ms | 409 KiB | 5 Q