php函数


//1.简单函数
/*function text()
{
echo "简单函数";
}
text();*/
//2.有参数的函数
/*function text($a)
{
echo $a;
}
text($a);*/
//3.有返回值的函数
/*function text()
{
return "测试";
}
echo text();*/
//4.可变参数的函数
/*function text()
{
$arr=func_get_args();//获取所有参数,返回数组
$sum=0;
for($i=0;$i<count($arr);$i++)
{
$sum=$sum+$arr[$i];
}
return $sum;
}
echo text(1,2,3,4,5);*/

//生成随机数
//echo rand(0,10);

//日期时间
//echo time();

//Y代表年份 m月份 d天 H代表24小时进制 i分钟 s秒
//echo date("Y-m-d H:i:s");
//将字符串转换为时间戳
echo strtotime("2017-4-14 14:14:20");

原文地址:https://www.cnblogs.com/douchenchen/p/6709416.html