3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "å\nä"; var_export(preg_split('/.\K/u', $string, 0, PREG_SPLIT_NO_EMPTY)); echo "\n---\n"; var_export(preg_split('/.\K/us', $string, 0, PREG_SPLIT_NO_EMPTY)); echo "\n---\n"; var_export(preg_split('/\X\K/u', $string, 0, PREG_SPLIT_NO_EMPTY));
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.22, 8.1.0 - 8.1.9
array ( 0 => 'å', 1 => ' ä', ) --- array ( 0 => 'å', 1 => ' ', 2 => 'ä', ) --- array ( 0 => 'å', 1 => ' ', 2 => 'ä', )

preferences:
60.26 ms | 409 KiB | 5 Q