脚本宝典收集整理的这篇文章主要介绍了PHP试图计算段落之间的空格,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<?PHP $file="text.txt"; $spaceCount = 0; $lineCount = 0; $plainCount = $lineCount- $spaceCount; $handle = foPEn($file,"r"); while(!feof($handle)) { $line = fgets($handle); if(ctype_PRint($line)) { $lineCount++; } else { $spaceCount++; } } fclose($handle); ?> <htML> <body> <?PHP echo "<table border=\"1\">"; echo "<tr>"; echo "<td> total lines ".$lineCount."</td>"; echo "</tr>"; echo "<tr>"; echo "<td> Total Spaces ".$spaceCount." </td>"; echo "</tr>"; echo "<tr>"; echo "<td> Plain Text Count ".$plainCount."</td>"; echo "</tr>"; ?> </body> </html>
TEXT,Text; Text Info-info info. Text More,Text
preg_match_all("/(\s)(\n)/",$string,$matches); $spaces = count($matches[0]); $lines = count($matches[1]);
以上是脚本宝典为你收集整理的PHP试图计算段落之间的空格全部内容,希望文章能够帮你解决PHP试图计算段落之间的空格所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。