3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $types = ['auto', 'int', 'float', 'string', 'html', 'list', 'pattern']; // echo '('.implode('|', $types).')'; $str = 'fdssdf,565848,sdf,dsf,sdf,новаева,f,sdf'; preg_match_all('/(\w+\,)|\w+/iu', $str, $matches); var_dump($matches);
based on 726Fb
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
array(2) { [0]=> array(8) { [0]=> string(7) "fdssdf," [1]=> string(7) "565848," [2]=> string(4) "sdf," [3]=> string(4) "dsf," [4]=> string(4) "sdf," [5]=> string(15) "новаева," [6]=> string(2) "f," [7]=> string(3) "sdf" } [1]=> array(8) { [0]=> string(7) "fdssdf," [1]=> string(7) "565848," [2]=> string(4) "sdf," [3]=> string(4) "dsf," [4]=> string(4) "sdf," [5]=> string(15) "новаева," [6]=> string(2) "f," [7]=> string(0) "" } }