[PHP]实用函数10

yipeiwu_com6年前PHP代码库
//将IP点分地址的字符转化回IP v4格式地址

int ip2long(string ip_address)
//将IP v4格式地址转化回IP点分地址的字符串

string long2ip(int proper_address)
//取得环境变量 varname,成功则传回变量值,失败由传回false

string getenv(string varname)
//用来设定系统环境

void putenv(string setting)
//获得当前PHP脚本的属主名

string get_current_user(void)
//调用function_name指定的用户函数

string get_cfg_var(string function_name[,mixed parrameter[,mixed...]])
//返回与 service 关联的端口(protocol),必须是TCP或UDP

int getservbyname(string service,string protocol)
//返回与 port 关联的服务名(protocol),必须是TCP或UDP

string getservbyport(int port,string protocol)
//取绝对值

mixed abs(mixed number)
//开平方根

float sqrt(float arg)
//自然对数e的次方值

float exp(float arg)
//返回圆周率

double pi(void)
//四舍五入

double round(double val)
//计算大于指定数的最小整数

int ceil(float number)
//计算小于指定的最大整数

int floor(float number)
//取最大值

mixed max(mixed arg1,mixed arg2...mixed argn)
//取最小值

mixed min(mixed arg1,mixed arg2...mixed argn)
//取随机数

int rand([int min],[int max])
//数制转换

string base_convert(string number,int frombase,int tobase)
//格式化数字字符串

string number_format(float number,int[decimals],string[decpoint],string[thounsands_sep])

相关文章

PHP_Cooikes不同页面无法传递的解决方法

这是我刚开始设置的cookies 复制代码 代码如下: setcookie("QQ_access_token",$_SESSION['access_token'],time()+3600...

PHP下编码转换函数mb_convert_encoding与iconv的使用说明

不过英文一般不会存在编码问题,只有中文数据才会有这个问题。比如你用Zend Studio或Editplus写程序时,用的是gbk编码,如果数据需要入数据库,而数据库的编码为utf8时,这...

Apache2 httpd.conf 中文版

Apache2 httpd.conf 中文版  # # 基于 NCSA 服务的配置文件。 # #这是Apache服务器主要配置...

静态html文件执行php语句的方法(推荐)

HTM文件中的PHP语句不会被执行,如何在HTML文件中运行php代码? html文件执行php语句的方法: 1,修改httpd.conf,命令Apache把HTML当作PHP, 需要修...

浅析php变量修饰符static的使用

静态变量仅在局部函数域中存在,但当程序执行离开此作用域时,其值并不丢失。看看下面的例子:复制代码 代码如下:function test(){static $a=0;$a++;echo $...