php字符串分割多个分隔符,如何在PHP中使用多個分隔符拆分字符串?

1

The split() PHP function allows the delimiter to be a regular expression. Unfortunately it's deprecated and will be removed in PHP7!

split() PHP函數允許分隔符是正則表達式。不幸的是,它已被棄用,將在PHP7中刪除!

The preg_split() function should be OK, and it returns an array:

preg_split()函數應該是OK,並返回一個數組:

$results = preg_split('/[;,]/', $string);

There are a few extra optional parameters which may be useful to you.

有一些額外的可選參數可能對您有用。

Is the first delimiter character in your edited example actually a 2 byte Unicode character?

在您編輯的示例中,第一個分隔符實際上是一個2字節的Unicode字符嗎?

Perhaps the preg_slit() function is treating the delimiter as three characters and splitting between the characters of the unicode (Chinese?) 'character'

也許preg_cut()函數將分隔符視為三個字符,並在unicode字符(中文?)之間進行分割。“性格”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值