couple of variables for better understanding. Combination of str_replace, explode and array_filter for clean the result:
<?php
$paragraph = "one-two / hi hello, universe";
$junk = ['/',',','.',';','-'];
$delimiteer = ' '; // space is better!
$words = array_filter(explode($delimiteer, str_replace($junk, ' ',$paragraph)), function($item){
return trim($item) !== "";
});
var_dump($words);
That's better now👌🏼
❤️❤️
@being_void_xd This is better
That is not a good one-liner. You'd better follow this: var_dump(preg_split('~\PL~', $paragraph, -1, PREG_SPLIT_NO_EMPTY));
Обсуждают сегодня