PHP: how to split a string with a delimiter -
I have this string that I would like to divide. I should start with this string 1060 and retain the string when I use preg_split (), it removes the string.
My code is:
$ array = preg_split ("/ 1060 [\ s] * *" / $, $ str);
Positive style:
$ array = preg_split ("/ (? = 1060 \ s) /", $ str) div class = "post-text" itemprop = "text"> ;
(? = 1060 \ s)
is a positive form - it claims to have regex ( 1060 \ s
) in it Can be matched, but it does not match. Therefore, it will match an empty string before the match and will correctly divide the text.
Comments
Post a Comment