08_基本函数
来源:互联网 发布:联想y5070优化教程 编辑:程序博客网 时间:2024/05/22 00:08
定义函数
function f(){
}
调用函数 f();
可变函数
function f(){
}
$f1='f';
$f1();
匿名函数
$f=function ($str){
echo $str;
};
$f("helloworld");
函数的局部变量
function t(){
$m="hello";
$s=function($a) user ($m){
echo $m
}
}
基本函数
$str="helloworld";
int strlen($str);//用于计算str的长度
header('Contetn-type;text/html:charset=utf-8');
strtoupper($str);//字母转换大写
strtolower($str);//字母全部小写
ucfirst($str);首字母大写
uworlds($str);每个单词大写
str_replace('new','old',$str);
str_ireplace('new','old',$str);
htmlspecialchars($str);
trim();
ltrim();
rtrim();
strpos($str1,$str2);//计算str1的第一次出现的位置
stripos();//不区分大小写
strrpos();
strripos();//最后一次
substr($str,int start,int length);截取
strstr();
stristr();
strchr();
$str1='asdcfsfc';
$str2='c';
strchr($str1,$str2);//cfsfc
strichr($str1,$str2);//c
strrev($str);取反
md5($str);加密
str_shuffle($str);//打乱
explode($str);//分割
implode($str);//结合数组
sprintf();格式化字符串
数学函数
ceil (2.7)=3;
float(2.7)=2;
pow(2,3)=8;
sqrt(4)=2;
min($arr);
max();
rand(1,100);
mt_rand(1,100);
round(66.564,2)=66.56;
时间函数
number_format();
fmod(7.8,3)=1.8
echo date(Y-m-d H:i:s);
date_default_timezone_set(Asia/Shanghai);//设置时区
date_default_timezone_get();//获得时区
time();时间戳
strtotime('-3 weeks');//时间上三周
microtime();
- 08_基本函数
- 网络编程学习_基本socket函数
- HTML_10_javascript_基本对象_语法规则,函数
- Python基本语法_函数_返回值
- Python基本语法_文件操作_读写函数详解
- orcale基本函数1_--NULL值校验
- MFC基本对话框_串口(COM)扫描函数总结
- Python基本语法_函数_参数的多类型传值
- Python基本语法_函数属性 & 参数类型 & 偏函数的应用
- Python基本语法_函数属性 & 参数类型 & 偏函数的应用
- 数据仓库_基本架构
- Android动画_基本
- GreenDao基本使用_
- unity 基本函数整理[4_Unity脚本 + 5_游戏元素的设计]
- 网络编程_常用的基本函数介绍——htonl、ntohl、htons、ntohs
- MYSQL_DATE_FORMAT()_函数_详解
- 08_传智播客Spring2.5视频教程_编码剖析Spring装配基本属性的原理
- [Objective-c]_[NSUserDefaults]_[基本使用]
- mysql安装过程遇到的问题以及解决方案
- java的历史与展望
- js运动与变化
- Ubuntu 14.04 server配置使用无线连接静态设置IP
- 数据结构---栈---链式存储
- 08_基本函数
- c++使用c# DataSet方法
- HTTP网络连接相关知识整理(一):http连接与Socket连接
- wdcp配置https
- 让我们来导出unity3d中的mainTexture贴图转换保存为png
- 如何实现抽屉效果
- php常用函数(持续更新)
- TCP协议分析和详细解析
- SQL函数