3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = ' one! two: three; "four" '; print_r(str_word_count($str, 1)); print_r(preg_split("/\s+/",trim($str))); print_r(array_filter(explode(' ', implode(' ', array_map('trim', explode("\n", $str))))));

preferences:
45.35 ms | 402 KiB | 5 Q