0
我想分割字符串一个特定的词即。拆分字符串在字
$whois = "Record last updated on 10-Apr-2011.Record expires on 08-Oct-2012.Record Expires on 08-Oct-2008.";
preg_split('/Expires|expires/', $whois, $expires);
echo "<pre>";
print_r($expires);
抓我的头在这个尝试很多不同的解决方案需要帮助。只是想要将字符串拆分成与爆炸字符相同的字符。
所以我会得到这样的东西。
array([0]=>'expires on 08-Oct-2012.Record',[1]=>'Expires on 08-Oct-2008.')
帮助
@DCHP请注意,当expires介于其他单词即blaexpiresbla之间时,您可能会引入问题 - 这也会匹配。作为预防措施,您几乎总是应该将单词放在单词边界\ bword \ b中。 – FailedDev