In PHP, which is faster: preg_split or explode?

前端 未结 3 2053
不知归路
不知归路 2020-12-06 04:20

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]+/\', $         


        
3条回答
  •  旧时难觅i
    2020-12-06 05:23

    Explode is faster, per PHP.net

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

提交回复
热议问题