3v4l.org

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

preferences:
34.31 ms | 402 KiB | 5 Q