3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string ='華中六街';var_dump(mb_detect_encoding($string)); var_dump($without = preg_split('/\s+/', $string)); var_dump($with = preg_split('/\s+/u', $string)); var_dump($with == $without); $string ='華中 六街'; var_dump(mb_detect_encoding($string)); var_dump($without = preg_split('/\s+/', $string)); var_dump($with = preg_split('/\s+/u', $string)); var_dump($with == $without);
based on KS5Sa
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(5) "UTF-8" array(1) { [0]=> string(12) "華中六街" } array(1) { [0]=> string(12) "華中六街" } bool(true) string(5) "UTF-8" array(2) { [0]=> string(6) "華中" [1]=> string(6) "六街" } array(2) { [0]=> string(6) "華中" [1]=> string(6) "六街" } bool(true)