Lots of questions similar but I have a specific example I would like some help with please. Migrating older php 5.2 code to 5.3
for($s=0;$s<count($tmp=split("/",$check_for));$s++)
assumed would be
for($s=0;$s<count($tmp=preg_split("///",$check_for));$s++)
However, I get
Warning: preg_split() [function.preg-split]: Unknown modifier '/'
Can someone give me some direction please? Thank you.
The first character of a preg_XXX
pattern is the separator which separates the pattern from the options that follow. Therefore, you cannot use the separator in the pattern itself without escaping it.
Consider using a different separator, like ~
:
for($s=0;$s<count($tmp=preg_split("~/~",$check_for));$s++)