is_numeric 检测变量是否为数字或数字字符串
array_search 数组中检索值,并返回键名
strrpos 在字符串中最后一次出现的位置
parse_url 解析url函数
in_array("Mark", $people)
foreach ($zparr as $key => $value)
str_pad() 函数把字符串填充为新的长度。str_pad($d,2,"0",STR_PAD_LEFT)
explode(",",$arr) 把字符串打散为数组
implode(",",$arr); 把数组元素组合为字符串
$result=array_flip($a1); 反转数组中所有的键以及它们关联的值
str_replace("world","Shanghai","Hello world!");把字符串 "Hello world!" 中的字符 "world" 替换为 "Shanghai"
strpos($v,"周一") 查找字符串出现次
移除数组中重复的值:array_unique($a)
数组去除空值--用回调函数过滤数组中的单元
array_filter(explode(",",$str));
strip_tags($value) 过滤html
直接取整,舍弃小数,保留整数:intval()
四舍五入取整:round() round(3.14159);
向上取整,有小数就加1:ceil() ceil(3.14159)
向下取整:floor() floor(3.14159);
保留两位小数 sprintf("%.2f",$num)
日期加一天 strtotime("+1 day",time())
strtotime($t);
date('Y-m-d H:i:s',$t)
PHP 常用函数 待续 ......
猜你喜欢
转载自blog.csdn.net/leejing623/article/details/88368334
今日推荐
周排行