字符串函数的运用

原创 2018-12-15 11:08:33 575
摘要:字符串六种输出函数汇总。还有过滤与填充,大小写转换,特殊字符解析函数的运用。<?phpheader("Content-type: text/html; charset=utf-8");$arr=['id'=>' 89 ','Title'=>" php学习 ",'CONTENT'

字符串六种输出函数汇总。还有过滤与填充,大小写转换,特殊字符解析函数的运用。

<?php
header("Content-type: text/html; charset=utf-8");
$arr=['id'=>' 89 ','Title'=>" php学习 ",'CONTENT'=>"&lt;p&gt;这篇文章主要介绍了PHP设计模式&lt;/p&gt;"];

foreach($arr as $key=>$val){
   switch (strtolower($key)){
       case 'id': echo trim($val).'<hr>'; break;
       case 'title': echo trim($val).'<hr>';break;
       case 'content': echo trim(htmlspecialchars_decode($val)).'<hr>';break;

   }
}

?>

批改老师:韦小宝批改时间:2018-12-15 11:22:08
老师总结:你这好像没写全吧!课后写的时候要写全了!全部都得练习几遍!

发布手记

热门词条