你如何找到在PHP换行符? [英] How do you find a line break in php?
本文介绍了你如何找到在PHP换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对不起,我不是用PHP好呢,我想这找到它,然后把每行中的数组
$翻译=此
在
多
线;
$ lastBreak = 0;
$它=阵列();
$ CI = 0;
为($ i = 1; $ I<的strlen($翻译); $ I ++){
如果和strchr(SUBSTR($翻译,$ I,$ I),\\ n){
$其[$ CI = SUBSTR($翻译,$ lastBreak + 1,$ I-1);
$ CI + = 1;
$ lastBreak = $ I;
}
}
帮助?
解决方案
$吧=爆炸(\\ n,$翻译);
:)
Sorry I ain't that good with PHP yet, I tried this to find it and then put each line in an array
$translate="this
is in
multiple
lines";
$lastBreak=0;
$it=array();
$ci=0;
for ($i=1;$i<strlen($translate);$i++) {
if strchr(substr($translate,$i,$i),"\n") {
$it[$ci]=substr($translate,$lastBreak+1,$i-1);
$ci+=1;
$lastBreak=$i;
}
}
help?
解决方案
$it = explode("\n", $translate);
:)
这篇关于你如何找到在PHP换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文