3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "foo bar, php js double-space apo'strophe 9"; echo 'explode(): '; var_export(explode(' ', $input)); echo "\npreg_split(): "; var_export(preg_split('/ +/', $input, null, PREG_SPLIT_NO_EMPTY)); echo "\nstr_word_count(): "; var_export(str_word_count($input, 1)); echo "\npreg_match_all(): "; var_export(preg_match_all('/[a-z]+/', $input, $output) ? $output[0]: []);

preferences:
24.99 ms | 408 KiB | 5 Q