php5.0及mysql5.0 函数的使用摘录(1)
2005-10-13 15:43
741 查看
1)func_get_args():--returns an array comprising a function's argument list
//返回一个由函数参数组成的数组
description
//描述
array func_get_args( void )
returns an array in which each element is the correspoonding member of the current user-defined function's argument list.
//返回一个数组,其每个元素对应当前用户所定义的函数的的参数列
<?php
function foo(){
$numargs = func_num_args ();
echo "Number of arguments: $numargs<br />/n";
if ($numargs >= 2 ){
echo "Second argument is :" . func_get_arg(1) . "<br />/n";
}
$arg_list = func_get_args();
for( ($i =0; $i < $numargs; $i++){
echo "Argument $i is: " . $arg_list[$i]. "<br />/n";
}
}
foo(1,2,3);
?>
2)array_slice( void );
该函数跟字符串截取函数substr类似,只是对象是数组,通过该函数可以截取数组的某一段区间;
3)is_resource($string)
用来判断传入参数是否为资源;
<?php
$m_sql = "select * from tb where 1<2";
$m_quy = mysql_query($m_sql);
if(is_resource($m_quy)){
print "true";
}
?>
4)mysql_unbuffered_query()
不通过缓存直接输出结果
注意点:
1)在获取结果后,需要马上就提取所有结果集;否则当执行下一条的mysql_unbuffered_query()后,前面的结果将被覆盖;
2)该函数使用后,不能通过mysql_num_rows()和mysql_data_seek()来提取结果
//返回一个由函数参数组成的数组
description
//描述
array func_get_args( void )
returns an array in which each element is the correspoonding member of the current user-defined function's argument list.
//返回一个数组,其每个元素对应当前用户所定义的函数的的参数列
<?php
function foo(){
$numargs = func_num_args ();
echo "Number of arguments: $numargs<br />/n";
if ($numargs >= 2 ){
echo "Second argument is :" . func_get_arg(1) . "<br />/n";
}
$arg_list = func_get_args();
for( ($i =0; $i < $numargs; $i++){
echo "Argument $i is: " . $arg_list[$i]. "<br />/n";
}
}
foo(1,2,3);
?>
2)array_slice( void );
该函数跟字符串截取函数substr类似,只是对象是数组,通过该函数可以截取数组的某一段区间;
3)is_resource($string)
用来判断传入参数是否为资源;
<?php
$m_sql = "select * from tb where 1<2";
$m_quy = mysql_query($m_sql);
if(is_resource($m_quy)){
print "true";
}
?>
4)mysql_unbuffered_query()
不通过缓存直接输出结果
注意点:
1)在获取结果后,需要马上就提取所有结果集;否则当执行下一条的mysql_unbuffered_query()后,前面的结果将被覆盖;
2)该函数使用后,不能通过mysql_num_rows()和mysql_data_seek()来提取结果
相关文章推荐
- PHP register_shutdown_function()函数的使用示例
- PHP strtr() 函数使用说明
- php数组合并array_merge()函数使用注意事项
- php使用curl函数往服务器put文件
- php使用fsockopen函数发送post,get请求获取网页内容的方法
- php 函数使用方法与函数定义方法
- php使用glob函数快速查询指定目录文件的方法
- PHP管理内存函数 memory_get_usage()使用介绍
- php使用preg_match()函数验证ip地址的方法
- PHP之使用网络函数和协议函数
- PHP 使用header函数设置HTTP头的示例方法 表头
- php 使用函数中遇到的坑之----list
- php 图书管理信息系统使用函数总结
- PHP可变函数的使用详解
- PHP操作文件的一些基本函数使用示例
- PHP使用BC Math 函数处理浮点运算问题
- php使用crypt()函数进行加密
- php unlink()函数使用教程
- 浅析PHP中call user func()函数及如何使用call user func调用自定义函数
- php使用str_shuffle()函数生成随机字符串的方法分析