Marco Marco - 4 years ago 99
PHP Question

In PHP, which is faster: preg_split or explode?

This may sound like a stupid question, but: which is faster when using it to extract keywords in a search query in php:

$keyword = preg_split('/[\s]+/', $_GET['search']);


$keyword = explode(' ', $_GET['search']);

Answer Source

Explode is faster, per

Tip If you don't need the power of regular expressions, you can choose faster (albeit simpler) alternatives like explode() or str_split().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download