3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $p = '/(\w+\*(?:$|\s+))|([^\s]+)/'; $a = array('Optionsschei*', 'optionsschei*', 'Optionsschein', 'optionsschein', 'Optionsschei* test', 'optionsschei* test'); foreach ($a as $q) { echo "\n\n$q\n"; $res = preg_match_all($p, $q, $m); var_dump($m); var_dump($res); }
Output for 4.3.0 - 7.1.0
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) 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) Optionsschein array(3) { [0]=> array(1) { [0]=> string(13) "Optionsschein" } [1]=> array(1) { [0]=> string(0) "" } [2]=> array(1) { [0]=> string(13) "Optionsschein" } } int(1) optionsschein array(3) { [0]=> array(1) { [0]=> string(13) "optionsschein" } [1]=> array(1) { [0]=> string(0) "" } [2]=> array(1) { [0]=> string(13) "optionsschein" } } int(1) Optionsschei* test array(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) optionsschei* test array(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)