PHP case-insensitive explode()
Just use preg_split()
and pass the flag i
for case-insensitivity:
$keywords = preg_split("/your delimiter/i", $text);
Also make sure your delimiter which you pass to preg_split()
doesn't cotain any sepcial regex characters. Otherwise make sure you escape them properly or use preg_quote()
.
You can first replace the delimiter and then use explode as normal. This can be done as a fairly readable one liner like this:
explode($delimiter,str_ireplace($delimiter,$delimiter,$snippet));