PHP函数大全.docx

上传人:牧羊曲112 文档编号:3163773 上传时间:2023-03-11 格式:DOCX 页数:55 大小:60.44KB
返回 下载 相关 举报
PHP函数大全.docx_第1页
第1页 / 共55页
PHP函数大全.docx_第2页
第2页 / 共55页
PHP函数大全.docx_第3页
第3页 / 共55页
PHP函数大全.docx_第4页
第4页 / 共55页
PHP函数大全.docx_第5页
第5页 / 共55页
亲,该文档总共55页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《PHP函数大全.docx》由会员分享,可在线阅读,更多相关《PHP函数大全.docx(55页珍藏版)》请在三一办公上搜索。

1、PHP函数大全PHP常用函数大全 字符串函数(important) addcslashes 像C语言一样使用反斜线转义字符串中的字符 addslashes - 使用反斜线引用字符串 bin2hex - 将二进制数据转换成十六进制表示 chop - rtrim 的别名函数 chr - 返回相对应于 ascii 码值所指定的单个字符。 chunk_split - 将字符串分割成小块 convert_cyr_string - 将字符由一种 Cyrillic 字符转换成另一种 convert_uudecode - Decode a uuencoded string convert_uuencode -

2、 Uuencode a string count_chars - 返回字符串所用字符的信息 crc32 - 计算一个字符串的 crc32 多项式 crypt 将字符串用DES编码加密 echo 输出一个或者是多个字符串 explode - 使用一个字符串分割另一个字符串 fprintf 格式化一个字符串并输出 get_html_translation_table - Returns the translation table used by htmlspecialchars and htmlentities hebrev - Convert logical Hebrew text to vis

3、ual text hebrevc - Convert logical Hebrew text to visual text with newline conversion html_entity_decode 将所有的HTML实体转换成对应的字符 htmlentities 将所有的字符转换成HTML实体 htmlspecialchars_decode - 将特定的HTML实体转换为相应的字符 htmlspecialchars - 将特定的字符转换成HTML实体 implode 将一个数组的所有元素连接成一个字符串 join - implode函数的别名 levenshtein - Calcul

4、ate Levenshtein distance between two strings localeconv - Get numeric formatting information ltrim - 去除一个字符串左边的空白(或者是其他的字符) md5_file 将一个给定的文件用MD5编码 md5 - 将一个给定的字符串用MD5编码 metaphone - Calculate the metaphone key of a string money_format 将一个数字按照货币的格式进行格式化nl_langinfo - Query language and locale informat

5、ion nl2br - 在字符串中插入HTML换行标签。 number_format - Format a number with grouped thousands ord 返回一个字符的ASCII值 parse_str - 解析字符串变量 print 输出一个字符串 printf 格式化并输出该字符串 quoted_printable_decode - Convert a quoted-printable string to an 8 bit string quotemeta - Quote meta characters rtrim - 去除一个字符串右边的空白(或者是其他的字符) se

6、tlocale - Set locale information sha1_file 将一个文件用SHA1进行编码(加密) sha1 - 将一个字符串用SHA1进行编码(加密) similar_text - 计算两个字符串之间的相似性 soundex -计算一个字符串的soundex key sprintf 返回一个格式化后的字符串 sscanf - Parses input from a string according to a format str_ireplace - Case-insensitive version of str_replace. str_pad - Pad a st

7、ring to a certain length with another string str_repeat - 重复字符串 str_replace 替换指定的字符串 str_rot13 - Perform the rot13 transform on a string str_shuffle - Randomly shuffles a string str_split - 将一个字符串转换成一个数组 str_word_count - 返回一个字符串中单词的个数 strcasecmp - Binary safe case-insensitive string comparison strch

8、r - strstr 的别名 strcmp 字符串比较(二进制字符串比较) strcoll - Locale based string comparison strcspn - Find length of initial segment not matching mask strip_tags 将一个字符串中的HTML和PHP标记去除 stripcslashes - 去除使用像C语言方式添加的反斜杠。 stripos - Find position of first occurrence of a case-insensitive string在字符串中不区分大小写的查找字符(或者字符串)第

9、一次出现的位置 stripslashes - 去除使用函数addslashes添加的反斜杠。 stristr - Case-insensitive strstr strlen 取得字符串的长度 strnatcasecmp - Case insensitive string comparisons using a natural order algorithm strnatcmp - String comparisons using a natural order algorithm strncasecmp - 区分大小写比较两个字符串。 strncmp - Binary safe string

10、 comparison of the first n characters strpbrk - Search a string for any of a set of characters strpos - 查找一个字符在一个字符串中第一次出现的位置。 strrchr 返回从某字符最后一次出现的位置开始一直到字符串结束的子串。 strrev 将字符串颠倒输出 strripos - 返回某字符在字符串中最后一次出现的位置(不区分大小写)。 strrpos - 返回某字符在字符串中最后一次出现的位置(区分大小写)。 strspn - Find length of initial segment m

11、atching mask strstr 返回从某字符第一次出现的位置开始一直到字符串结束的子串(包含该字符)。 strtok - Tokenize string strtolower 将字符串所有字符转换为小写 strtoupper 将字符串所有字符转换为大写 strtr - Translate certain characters substr_compare - Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters substr_coun

12、t 计算子串出现的次数(区分大小写) substr_replace 字串替换 substr 返回指定位置的字串 trim 去掉字符串左右两边的空白(或者其他字符) ucfirst 使一个字符串的第一个字符大写 ucwords - 将一个字符串的每个单词的第一个字母大写 vfprintf - Write a formatted string to a stream vprintf 输出一个格式化后的字符串 vsprintf 返回一个格式化后的字符串 wordwrap - 使字符串在指定位置换行 例子: 数组函数(important) array_change_key_case - 返回字符串键名

13、全为小写或大写的数组 array_chunk - 将一个数组分割成多个 array_combine - 创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值 array_count_values - 统计数组中所有的值出现的次数 array_diff_assoc - 带索引检查计算数组的差集 array_diff_key - 使用键名比较计算数组的差集 array_diff_uassoc - 用用户提供的回调函数做索引检查来计算数组的差集 array_diff_ukey - 用回调函数对键名比较计算数组的差集 array_diff - 计算数组的差集 array_fill - 用给定

14、的值填充数组 array_filter - 用回调函数过滤数组中的单元 array_flip - 交换数组中的键和值 array_intersect_assoc - 带索引检查计算数组的交集 array_intersect_key - 使用键名比较计算数组的交集 array_intersect_uassoc - 带索引检查计算数组的交集,用回调函数比较索引 array_intersect_ukey - 用回调函数比较键名来计算数组的交集 array_intersect - 计算数组的交集 array_key_exists - 检查给定的键名或索引是否存在于数组中 array_keys - 返回

15、数组中所有的键名 array_map - 将回调函数作用到给定数组的单元上 array_merge_recursive - 递归地合并一个或多个数组 array_merge - 合并一个或多个数组 array_multisort - 对多个数组或多维数组进行排序 array_pad - 用值将数组填补到指定长度 array_pop - 将数组最后一个单元弹出 array_product - 计算数组中所有值的乘积 array_push - 将一个或多个单元压入数组的末尾 array_rand - 从数组中随机取出一个或多个单元 array_reduce - 用回调函数迭代地将数组简化为单一的值

16、 array_reverse - 返回一个单元顺序相反的数组 array_search - 在数组中搜索给定的值,如果成功则返回相应的键名 array_shift - 将数组开头的单元移出数组 array_slice - 从数组中取出一段 array_splice - 把数组中的一部分去掉并用其它值取代 array_sum - 计算数组中所有值的和 array_udiff_assoc - 带索引检查计算数组的差集,用回调函数比较数据 array_udiff_uassoc - 带索引检查计算数组的差集,用回调函数比较数据和索引 array_udiff - 用回调函数比较数据来计算数组的差集 ar

17、ray_uintersect_assoc - 带索引检查计算数组的交集,用回调函数比较数据 array_uintersect_uassoc - 带索引检查计算数组的交集,用回调函数比较数据和索引 array_uintersect - 计算数组的交集,用回调函数比较数据 array_unique - 移除数组中重复的值 array_unshift - 在数组开头插入一个或多个单元 array_values - 返回数组中所有的值 array_walk_recursive - 对数组中的每个成员递归地应用用户函数 array_walk - 对数组中的每个成员应用用户函数 array - 新建一个数

18、组 arsort - 对数组进行逆向排序并保持索引关系 asort - 对数组进行排序并保持索引关系 compact - 建立一个数组,包括变量名和它们的值 count - 计算数组中的单元数目或对象中的属性个数 current - 返回数组中的当前单元 each - 返回数组中当前的键值对并将数组指针向前移动一步 end - 将数组的内部指针指向最后一个单元 extract - 从数组中将变量导入到当前的符号表 in_array - 检查数组中是否存在某个值 key - 从关联数组中取得键名 krsort - 对数组按照键名逆向排序 ksort - 对数组按照键名排序 list - 把数组中

19、的值赋给一些变量 natcasesort - 用“自然排序”算法对数组进行不区分大小写字母的排序 natsort - 用“自然排序”算法对数组排序 next - 将数组中的内部指针向前移动一位 pos - current 的别名 prev - 将数组的内部指针倒回一位 range - 建立一个包含指定范围单元的数组 reset - 将数组的内部指针指向第一个单元 rsort - 对数组逆向排序 shuffle - 将数组打乱 sizeof - count 的别名 sort - 对数组排序 uasort - 使用用户自定义的比较函数对数组中的值进行排序并保持索引关联 uksort - 使用用户自

20、定义的比较函数对数组中的键名进行排序 usort - 使用用户自定义的比较函数对数组中的值进行排序 日历函数 cal_days_in_month - Return the number of days in a month for a given year and calendar cal_from_jd - Converts from Julian Day Count to a supported calendar cal_info - Returns information about a particular calendar cal_to_jd - Converts from a su

21、pported calendar to Julian Day Count easter_date - Get Unix timestamp for midnight on Easter of a given year easter_days - Get number of days after March 21 on which Easter falls for a given year FrenchToJD - Converts a date from the French Republican Calendar to a Julian Day Count GregorianToJD - C

22、onverts a Gregorian date to Julian Day Count JDDayOfWeek - Returns the day of the week JDMonthName - Returns a month name JDToFrench - Converts a Julian Day Count to the French Republican Calendar JDToGregorian - Converts Julian Day Count to Gregorian date jdtojewish - Converts a Julian day count to

23、 a Jewish calendar date JDToJulian - Converts a Julian Day Count to a Julian Calendar Date jdtounix - Convert Julian Day to Unix timestamp JewishToJD - Converts a date in the Jewish Calendar to Julian Day Count JulianToJD - Converts a Julian Calendar date to Julian Day Count unixtojd - Convert Unix

24、timestamp to Julian Day 时间函数(important) checkdate - 验证一个格里高里日期 date_default_timezone_get - 取得一个脚本中所有日期时间函数所使用的默认时区 date_default_timezone_set - 设定用于一个脚本中所有日期时间函数的默认时区 date_sunrise - 返回给定的日期与地点的日出时间 date_sunset - 返回给定的日期与地点的日落时间 date - 格式化一个本地时间日期 getdate - 取得日期时间信息 gettimeofday - 取得当前时间 gmdate - 格式化一

25、个 GMT/UTC 日期时间 gmmktime - 取得 GMT 日期的 UNIX 时间戳 gmstrftime - 根据区域设置格式化 GMT/UTC 时间日期 idate - 将本地时间日期格式化为整数 localtime - 取得本地时间 microtime - 返回当前 Unix 时间戳和微秒数 mktime - 取得一个日期的 Unix 时间戳 strftime - 根据区域设置格式化本地时间日期 strptime - 解析由 strftime 生成的日期时间 strtotime - 将任何英文文本的日期时间描述解析为 Unix 时间戳 time - 返回当前的 Unix 时间戳 M

26、YSQL数据库函数(important) mysql_affected_rows - 取得前一次 MySQL 操作所影响的记录行数 mysql_change_user - 改变活动连接中登录的用户 mysql_client_encoding - 返回字符集的名称 mysql_close - 关闭 MySQL 连接 mysql_connect - 打开一个到 MySQL 服务器的连接 mysql_create_db - 新建一个 MySQL 数据库 mysql_data_seek - 移动内部结果的指针 mysql_db_name - 取得结果数据 mysql_db_query - 发送一条 M

27、ySQL 查询 mysql_drop_db - 丢弃一个 MySQL 数据库 mysql_errno - 返回上一个 MySQL 操作中的错误信息的数字编码 mysql_error - 返回上一个 MySQL 操作产生的文本错误信息 mysql_escape_string - 转义一个字符串用于 mysql_query mysql_fetch_array - 从结果集中取得一行作为关联数组,或数字数组,或二者兼有 mysql_fetch_assoc - 从结果集中取得一行作为关联数组 mysql_fetch_field - 从结果集中取得列信息并作为对象返回 mysql_fetch_lengt

28、hs - 取得结果集中每个输出的长度 mysql_fetch_object - 从结果集中取得一行作为对象 mysql_fetch_row - 从结果集中取得一行作为枚举数组 mysql_field_flags - 从结果中取得和指定字段关联的标志 mysql_field_len - 返回指定字段的长度 mysql_field_name - 取得结果中指定字段的字段名 mysql_field_seek - 将结果集中的指针设定为制定的字段偏移量 mysql_field_table - 取得指定字段所在的表名 mysql_field_type - 取得结果集中指定字段的类型 mysql_free

29、_result - 释放结果内存 mysql_get_client_info - 取得 MySQL 客户端信息 mysql_get_host_info - 取得 MySQL 主机信息 mysql_get_proto_info - 取得 MySQL 协议信息 mysql_get_server_info - 取得 MySQL 服务器信息 mysql_info - 取得最近一条查询的信息 mysql_insert_id - 取得上一步 INSERT 操作产生的 ID mysql_list_dbs - 列出 MySQL 服务器中所有的数据库 mysql_list_fields - 列出 MySQL 结

30、果中的字段 mysql_list_processes - 列出 MySQL 进程 mysql_list_tables - 列出 MySQL 数据库中的表 mysql_num_fields - 取得结果集中字段的数目 mysql_num_rows - 取得结果集中行的数目 mysql_pconnect - 打开一个到 MySQL 服务器的持久连接 mysql_ping - Ping 一个服务器连接,如果没有连接则重新连接 mysql_query - 发送一条 MySQL 查询 mysql_real_escape_string - 转义 SQL 语句中使用的字符串中的特殊字符,并考虑到连接的当前字

31、符集 mysql_result - 取得结果数据 mysql_select_db - 选择 MySQL 数据库 mysql_stat - 取得当前系统状态 mysql_tablename - 取得表名 mysql_thread_id - 返回当前线程的 ID mysql_unbuffered_query - 向 MySQL 发送一条 SQL 查询,并不获取和缓存结果的行 PostgreSQL数据库函数 pg_affected_rows - 返回受影响的记录数目 pg_cancel_query - 取消异步查询 pg_client_encoding - 取得客户端编码方式 pg_close -

32、关闭一个 PostgreSQL 连接 pg_connect - 打开一个 PostgreSQL 连接 pg_connection_busy - 获知连接是否为忙 pg_connection_reset - 重置连接 pg_connection_status - 获得连接状态 pg_convert - 将关联的数组值转换为适合 SQL 语句的格式。 pg_copy_from - 根据数组将记录插入表中 pg_copy_to - 将一个表拷贝到数组中 pg_dbname - 获得数据库名 pg_delete - 删除记录 pg_end_copy - 与 PostgreSQL 后端同步 pg_esc

33、ape_bytea - 转义 bytea 类型的二进制数据 pg_escape_string - 转义 text/char 类型的字符串 pg_execute - Sends a request to execute a prepared statement with given parameters, and waits for the result. pg_fetch_all_columns - Fetches all rows in a particular result column as an array pg_fetch_all - 从结果中提取所有行作为一个数组 pg_fetch

34、_array - 提取一行作为数组 pg_fetch_assoc - 提取一行作为关联数组 pg_fetch_object - 提取一行作为对象 pg_fetch_result - 从结果资源中返回值 pg_fetch_row - 提取一行作为枚举数组 pg_field_is_null - 测试字段是否为 NULL pg_field_name - 返回字段的名字 pg_field_num - 返回字段的编号 pg_field_prtlen - 返回打印出来的长度 pg_field_size - 返回指定字段占用内部存储空间的大小 pg_field_type_oid - Returns the

35、type ID (OID) for the corresponding field number pg_field_type - 返回相应字段的类型名称 pg_free_result - 释放查询结果占用的内存 pg_get_notify - Ping 数据库连接 pg_get_pid - Ping 数据库连接 pg_get_result - 取得异步查询结果 pg_host - 返回和某连接关联的主机名 pg_insert - 将数组插入到表中 pg_last_error - 得到某连接的最后一条错误信息 pg_last_notice - 返回 PostgreSQL 服务器最新一条公告信息

36、pg_last_oid - 返回上一个对象的 oid pg_lo_close - 关闭一个大型对象 pg_lo_create - 新建一个大型对象 pg_lo_export - 将大型对象导出到文件 pg_lo_import - 将文件导入为大型对象 pg_lo_open - 打开一个大型对象 pg_lo_read_all - 读入整个大型对象并直接发送给浏览器 pg_lo_read - 从大型对象中读入数据 pg_lo_seek - 移动大型对象中的指针 pg_lo_tell - 返回大型对象的当前指针位置 pg_lo_unlink - 删除一个大型对象 pg_lo_write - 向大型对

37、象写入数据 pg_meta_data - 获得表的元数据 pg_num_fields - 返回字段的数目 pg_num_rows - 返回行的数目 pg_options - 获得和连接有关的选项 pg_parameter_status - Looks up a current parameter setting of the server. pg_pconnect - 打开一个持久的 PostgreSQL 连接 pg_ping - Ping 数据库连接 pg_port - 返回该连接的端口号 pg_prepare - Submits a request to create a prepared

38、 statement with the given parameters, and waits for completion. pg_put_line - 向 PostgreSQL 后端发送以 NULL 结尾的字符串 pg_query_params - Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text. pg_query - 执行查询 pg_result_error_field - R

39、eturns an individual field of an error report. pg_result_error - 获得查询结果的错误信息 pg_result_seek - 在结果资源中设定内部行偏移量 pg_result_status - 获得查询结果的状态 pg_select - 选择记录 pg_send_execute - Sends a request to execute a prepared statement with given parameters, without waiting for the result(s). pg_send_prepare - Sen

40、ds a request to create a prepared statement with the given parameters, without waiting for completion. pg_send_query_params - Submits a command and separate parameters to the server without waiting for the result(s). pg_send_query - 发送异步查询 pg_set_client_encoding - 设定客户端编码 pg_set_error_verbosity - De

41、termines the verbosity of messages returned by pg_last_error and pg_result_error. pg_trace - 启动一个 PostgreSQL 连接的追踪功能 pg_transaction_status - Returns the current in-transaction status of the server. pg_tty - 返回该连接的 tty 号 pg_unescape_bytea - 取消 bytea 类型中的字符串转义 pg_untrace - 关闭 PostgreSQL 连接的追踪功能 pg_upd

42、ate - 更新表 pg_version - Returns an array with client, protocol and server version (when available) Oracle数据库函数 OCI-Collection-append - 向 collection 增加单元 OCI-Collection-assign - 从现有的另一个 collection 向 collection 赋值 OCI-Collection-assignElem - 给 collection 中的单元赋值 OCI-Collection-free - 释放关联于 collection 的对

43、象的资源 OCI-Collection-getElem - 返回单元的值 OCI-Collection-max - 返回 collection 中单元的最大数目 OCI-Collection-size - 返回 collection 中的单元数目 OCI-Collection-trim - 从 collection 尾端开始删除单元 OCI-Lob-append - Appends data from the large object to another large object OCI-Lob-close - 关闭 LOB 描述符 OCI-Lob-eof - Tests for end-o

44、f-file on a large objects descriptor OCI-Lob-erase - Erases a specified portion of the internal LOB data OCI-Lob-export - 将 LOB 的内容导出到文件中 OCI-Lob-flush - Flushes/writes buffer of the LOB to the server OCI-Lob-free - 释放与 LOB 描述符所关联的资源 OCI-Lob-getBuffering - Returns current state of buffering for the large object OCI-Lob-import - 将数据从文件导入 LOB OCI-Lob-load - 返回大对象的内容 OCI-Lob-read - Reads part of the large object OCI-Lob-rewind - Moves the internal pointer to the beginning of the large obj

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号