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

后端 未结 6 1698
一生所求
一生所求 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:41

    The split() function splits the string into an array using a regular expression and returns an array.

    The explode() function splits the string by string.

    E.g:

    
    

    The result will be

    Array ( [0] => I [1] => P [2] => S ) 
    Array ( [0] => I [1] => P [2] => S )
    

    Note:The function split() was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0

提交回复
热议问题