What is the difference between split() and explode()?

后端 未结 6 1693
一生所求
一生所求 2020-12-29 02:06

The PHP manual for split() says

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly dis

6条回答
  •  攒了一身酷
    2020-12-29 02:37

    It's been deprecated because

    • explode() is substantially faster because it doesn't split based on a regular expression, so the string doesn't have to be analyzed by the regex parser
    • preg_split() is faster and uses PCRE regular expressions for regex splits

    join() and implode() are aliases of each other and therefore don't have any differences.

提交回复
热议问题