3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $p = '/([a-z0-9]+\*(?:$|\s+))|([^\s]+)/'; $a = array('Optionsschei*', 'optionsschei*', 'Optionsschein', 'optionsschein', 'Optionsschei* test', 'optionsschei* test'); foreach ($a as $q) { echo "\n$q"; $res = preg_match_all($p, $q, $m); var_dump($m); var_dump($res); }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Optionsschei*array(3) { [0]=> array(1) { [0]=> string(13) "Optionsschei*" } [1]=> array(1) { [0]=> string(0) "" } [2]=> array(1) { [0]=> string(13) "Optionsschei*" } } int(1) optionsschei*array(3) { [0]=> array(1) { [0]=> string(13) "optionsschei*" } [1]=> array(1) { [0]=> string(13) "optionsschei*" } [2]=> array(1) { [0]=> string(0) "" } } int(1) Optionsscheinarray(3) { [0]=> array(1) { [0]=> string(13) "Optionsschein" } [1]=> array(1) { [0]=> string(0) "" } [2]=> array(1) { [0]=> string(13) "Optionsschein" } } int(1) optionsscheinarray(3) { [0]=> array(1) { [0]=> string(13) "optionsschein" } [1]=> array(1) { [0]=> string(0) "" } [2]=> array(1) { [0]=> string(13) "optionsschein" } } int(1) Optionsschei* testarray(3) { [0]=> array(2) { [0]=> string(13) "Optionsschei*" [1]=> string(4) "test" } [1]=> array(2) { [0]=> string(0) "" [1]=> string(0) "" } [2]=> array(2) { [0]=> string(13) "Optionsschei*" [1]=> string(4) "test" } } int(2) optionsschei* testarray(3) { [0]=> array(2) { [0]=> string(14) "optionsschei* " [1]=> string(4) "test" } [1]=> array(2) { [0]=> string(14) "optionsschei* " [1]=> string(0) "" } [2]=> array(2) { [0]=> string(0) "" [1]=> string(4) "test" } } int(2)