Ema*_*oom 4 php string explode
我试图爆炸空行.
这是我的字符串变量:
$string = '
Hello,
Just test lines
Second test lines
';
Run Code Online (Sandbox Code Playgroud)
我想要这些结果:
$OUTPUT[0]='HELLO,';
$OUTPUT[1]='Just test lines
Second test lines';
Run Code Online (Sandbox Code Playgroud)
我的代码:
$a = explode("\n\n",$string);
print_r($a);
Run Code Online (Sandbox Code Playgroud)
我的领域结果:
Array ( [0] => Hello, Just test lines Second test lines )
Run Code Online (Sandbox Code Playgroud)
Kęs*_*tis 12
这应该做的伎俩:
$string = '
Hello,
Just test lines
Second test lines
';
$data = preg_split("#\n\s*\n#Uis", $string);
print_r($data);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3718 次 |
| 最近记录: |