<?php
header("Content-type:text/html;charset=utf-8");
$arr=200;
$result =($arr%2==0||$arr/2==100) ?$arr. "是闰年":$arr ."不是闰年";
echo $result;用到的为连接符,取反,是否为?
<?php
header("Content-type:text/html;charset=utf-8");
$arr=array("你好","大家好","非常好");
$rand=rand(0,2);
echo $arr[$rand]; rand函数随机,相当于数组下标
单引号和双引号的区别是单引号不能转义变量并输出,因为双引号的功能比单引号的强,还有单引号的执行效率高
连接符.,转义\可以进行区分等等操作变成了死符号。
$str=" select*from book where bookname='php 编程宝典' ";
$a=addslashes($str);
echo $a;
select*from book where bookname=\'php 编程宝典\' 结果
www.vbnv.comwww.vbnv.com 截取字符串 ,从第0个
echo $e=substr(("www.vbnv.com"), 0);
echo $e;
获取字符串长度 strlen
echo $e=substr(("www.vbnv.com"), 3,8); 从其三个起截取8个字符
echo $e=substr(("www.vbnv.com"), -3,8);从倒数三个起截取8个字符
echo $e=substr(("www.vbnv.com"), -3,-8);从倒数第三个起,截取到倒数第八个字符