PHP基础19-统计文章的字节数

来源:互联网 发布:淘宝 一键转让 编辑:程序博客网 时间:2024/05/20 08:02
<?php
    function unhtml($content){
        $content=htmlspecialchars($content);
        $content=str_replace(chr(13),"<br>",$content);
        $content=str_replace(chr(32),"&nbsp;",$content);
        return trim($content);
    }
    $str="标题:PHP 编程宝典<br>内容:PHP编程宝典非常好"
?>
<table border="1" bordercolor="#FF0000" cellspacing="0">
    <tr>
        <td><?php echo $str;?></td>
    </tr>
</table>

<?php echo "共有字节".strlen(unhtml($str))."个";?>


原创粉丝点击