There is such a line: "/ test 123 test 5-6 test 8 test". All tsiferki except the letters test, can vary, tell me, please, how to write them into an array, the number of spaces is the same -.-
$str = "/test 123 test 5-6 test 8 test"; preg_match_all(/(test\s*[-\d]*)+/,$str,$matches); print_r($matches);// => Array (  => test 123  => test 5-6  => test 8  => test )
/ и / around - limiters. They report that there is a regular inside.
\s - space (and a few more characters that look like it)
\s* - some spaces, 0-inf
 - character class
[-\d] is a character class consisting of numbers and hyphens. The hyphen in this value is ALWAYS at the beginning.
() - grouping. In general, it is not really needed here.
+ - any non-zero number of times. In this case, it is also not necessary, since preg_match_all is used.
<?php $str = "/test 123 test 5-6 test 8 test"; $a = explode(' ', $str); ?>
So not satisfied?