Exploding by Array of Delimiters

前端 未结 5 1916
伪装坚强ぢ
伪装坚强ぢ 2020-12-05 07:56

Is there any way to explode() using an array of delimiters?

PHP Manual:

array explode ( string $delimiter , string $string [, int $limit ] )

<
5条回答
  •  臣服心动
    2020-12-05 08:16

    php's explode method doesn't support multiple delimiters, so you can't pass it an array. Also, what kind of string are you parsing that has multiple delimiters? you're best bet would be to loop through your delimiters, and re-explode some of the exploded strings.

提交回复
热议问题