Home  >  Article  >  Backend Development  >  PHP regular problem, I want to match and split where (rn) appears twice

PHP regular problem, I want to match and split where (rn) appears twice

WBOY
WBOYOriginal
2016-09-11 11:34:071069browse

<code>$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
$data = preg_split("(\r\n){2}", $str, -1);
print_r($data);
</code>

Result:

PHP regular problem, I want to match and split where (rn) appears twice

Reply content:

<code>$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
$data = preg_split("(\r\n){2}", $str, -1);
print_r($data);
</code>

Result:

PHP regular problem, I want to match and split where (rn) appears twice

<code>    $str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
    $data = preg_split("/(\r\n){2}/", $str, -1);
    print_r($data);</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Questions about PhalconNext article:Questions about Phalcon