时间:2021-07-01 10:21:17 帮助过:3人阅读
- $length = strlen($str);
PHP常用语法2.PHP判断字符是否为NULL:
- if(!$str){
- echo "false"
- }else {
- echo "true"
- }
PHP常用语法3.link_to的使用:
- php echo link_to($question->getUser(),
'user/show?id='.$question->getUserId()) ?>
PHP常用语法4.PHP截取字符串:
- 1.split
- $arr = array();
- $arr = split("/",$str);<CODE><SPAN class=php_000000>
- SPAN>
- CODE>
PHP常用语法5. PHP替换字符串:
- 1. str_replace("-" , "/" , $str)
- "-" = 要替换的字符
- "/" = 替换后的字符
- 2.按数组方式替换:
- $arr = array("0","1","2","3","4","5","6","7","8","9");
- $repNum2 = str_replace($arr,"",$str);
PHP常用语法6.PHP获取数组长度:
- $i=count($array_name);
PHP常用语法7. PHP获得当前时间:
- $current_date = date("Ymd");
以上就是我们这次为大家总结的PHP常用语法。
http://www.bkjia.com/PHPjc/446352.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/446352.htmlTechArticlePHP常用语法 1.PHP获得字符串长度: $ length = strlen ($str); PHP常用语法2.PHP判断字符是否为NULL: if(!$str){ echo"false" }else{ echo"true" } PHP常用语法3.l...