熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> PHP編程 >> 正文

基於PHP中的常用函數回顧

2022-06-13   來源: PHP編程 
以下是對PHP中的常用函數進行了詳細的分析介紹需要的朋友可以參考下  

  array_change_key_case — 返回字符串鍵名全為小寫或大寫的數組
array_chunk — 將一個數組分割成多個
array_combine — 創建一個數組用一個數組的值作為其鍵名另一個數組的值作為其值
array_count_values — 統計數組中所有的值出現的次數
array_diff_assoc — 帶索引檢查計算數組的差集
array_diff_key — 使用鍵名比較計算數組的差集
array_diff_uassoc — 用用戶提供的回調函數做索引檢查來計算數組的差集
array_diff_ukey — 用回調函數對鍵名比較計算數組的差集
array_diff — 計算數組的差集
array_fill_keys — Fill an array with values specifying keys
array_fill — 用給定的值填充數組
array_filter — 用回調函數過濾數組中的單元
array_flip — 交換數組中的鍵和值
array_intersect_assoc — 帶索引檢查計算數組的交集
array_intersect_key — 使用鍵名比較計算數組的交集
array_intersect_uassoc — 帶索引檢查計算數組的交集用回調函數比較索引
array_intersect_ukey — 用回調函數比較鍵名來計算數組的交集
array_intersect — 計算數組的交集
array_key_exists — 檢查給定的鍵名或索引是否存在於數組中
array_keys — 返回數組中所有的鍵名
array_map — 將回調函數作用到給定數組的單元上
array_merge_recursive — 遞歸地合並一個或多個數組
array_merge — 合並一個或多個數組
array_multisort — 對多個數組或多維數組進行排序
array_pad — 用值將數組填補到指定長度
array_pop — 將數組最後一個單元彈出(出棧)
array_product — 計算數組中所有值的乘積
array_push — 將一個或多個單元壓入數組的末尾(入棧)
array_rand — 從數組中隨機取出一個或多個單元
array_reduce — 用回調函數迭代地將數組簡化為單一的值
array_reverse — 返回一個單元順序相反的數組
array_search — 在數組中搜索給定的值如果成功則返回相應的鍵名
array_shift — 將數組開頭的單元移出數組
array_slice — 從數組中取出一段
array_splice — 把數組中的一部分去掉並用其它值取代
array_sum — 計算數組中所有值的和
array_udiff_assoc — 帶索引檢查計算數組的差集用回調函數比較數據
array_udiff_uassoc — 帶索引檢查計算數組的差集用回調函數比較數據和索引
array_udiff — 用回調函數比較數據來計算數組的差集
array_uintersect_assoc — 帶索引檢查計算數組的交集用回調函數比較數據
array_uintersect_uassoc — 帶索引檢查計算數組的交集用回調函數比較數據和索引
array_uintersect — 計算數組的交集用回調函數比較數據
array_unique — 移除數組中重復的值
array_unshift — 在數組開頭插入一個或多個單元
array_values — 返回數組中所有的值
array_walk_recursive — 對數組中的每個成員遞歸地應用用戶函數
array_walk — 對數組中的每個成員應用用戶函數
array — 新建一個數組
arsort — 對數組進行逆向排序並保持索引關系
asort — 對數組進行排序並保持索引關系
compact — 建立一個數組包括變量名和它們的值
count — 計算數組中的單元數目或對象中的屬性個數
current — 返回數組中的當前單元
each — 返回數組中當前的鍵/值對並將數組指針向前移動一步
end — 將數組的內部指針指向最後一個單元
extract — 從數組中將變量導入到當前的符號表
in_array — 檢查數組中是否存在某個值
key — 從關聯數組中取得鍵名
krsort — 對數組按照鍵名逆向排序
ksort — 對數組按照鍵名排序
list — 把數組中的值賦給一些變量
natcasesort — 用“自然排序”算法對數組進行不區分大小寫字母的排序
natsort — 用“自然排序”算法對數組排序
next — 將數組中的內部指針向前移動一位
pos — current() 的別名
prev — 將數組的內部指針倒回一位
range — 建立一個包含指定范圍單元的數組
reset — 將數組的內部指針指向第一個單元
rsort — 對數組逆向排序
shuffle — 將數組打亂
sizeof — count() 的別名
sort — 對數組排序
uasort — 使用用戶自定義的比較函數對數組中的值進行排序並保持索引關聯
uksort — 使用用戶自定義的比較函數對數組中的鍵名進行排序
usort — 使用用戶自定義的比較函數對數組中的值進行排序
call_user_method_array — 調用一個用戶方法同時傳遞參數數組(已廢棄)
call_user_method — 對特定對象調用用戶方法(已廢棄)
class_exists — 檢查類是否已定義
get_class_methods — 返回由類的方法名組成的數組
get_class_vars — 返回由類的默認屬性組成的數組
get_class — 返回對象的類名
get_declared_classes — 返回由已定義類的名字所組成的數組
get_declared_interfaces — 返回一個數組包含所有已聲明的接口
get_object_vars — 返回由對象屬性組成的關聯數組
get_parent_class — 返回對象或類的父類名
interface_exists — 檢查接口是否已被定義
is_a — 如果對象屬於該類或該類是此對象的父類則返回 TRUE
is_subclass_of — 如果此對象是該類的子類則返回 TRUE
method_exists — 檢查類的方法是否存在
property_exists — 檢查對象或類是否具有該屬性
checkdate — 驗證一個格裡高裡日期
date_default_timezone_get — 取得一個腳本中所有日期時間函數所使用的默認時區
date_default_timezone_set — 設定用於一個腳本中所有日期時間函數的默認時區
date_time_set — Sets the time
date_timezone_get — Return time zone relative to given DateTime
date_timezone_set — Sets the time zone for the DateTime object
date — 格式化一個本地時間/日期
getdate — 取得日期/時間信息
gettimeofday — 取得當前時間
gmdate — 格式化一個 GMT/UTC 日期/時間
gmmktime — 取得 GMT 日期的 UNIX 時間戳
gmstrftime — 根據區域設置格式化 GMT/UTC 時間/日期
idate — 將本地時間日期格式化為整數
localtime — 取得本地時間
microtime — 返回當前 Unix 時間戳和微秒數
mktime — 取得一個日期的 Unix 時間戳
strftime — 根據區域設置格式化本地時間/日期
strptime — 解析由 strftime() 生成的日期/時間
strtotime — 將任何英文文本的日期時間描述解析為 Unix 時間戳
time — 返回當前的 Unix 時間戳
chdir — 改變目錄
chroot — 改變根目錄
dir — directory 類
closedir — 關閉目錄句柄
getcwd — 取得當前工作目錄
opendir — 打開目錄句柄
readdir — 從目錄句柄中讀取條目
rewinddir — 倒回目錄句柄
scandir — 列出指定路徑中的文件和目錄
basename — 返回路徑中的文件名部分
chgrp — 改變文件所屬的組
chmod — 改變文件模式
chown — 改變文件的所有者
clearstatcache — 清除文件狀態緩存
copy — 拷貝文件
delete — 參見 unlink() 或 unset()
dirname — 返回路徑中的目錄部分
disk_free_space — 返回目錄中的可用空間
disk_total_space — 返回一個目錄的磁盤總大小
diskfreespace — disk_free_space() 的別名
fclose — 關閉一個已打開的文件指針
feof — 測試文件指針是否到了文件結束的位置
fflush — 將緩沖內容輸出到文件
fgetc — 從文件指針中讀取字符
fgetcsv — 從文件指針中讀入一行並解析 CSV 字段
fgets — 從文件指針中讀取一行
fgetss — 從文件指針中讀取一行並過濾掉 HTML 標記
file_exists — 檢查文件或目錄是否存在
file_get_contents — 將整個文件讀入一個字符串
file_put_contents — 將一個字符串寫入文件
file — 把整個文件讀入一個數組中
fileatime — 取得文件的上次訪問時間
filectime — 取得文件的 inode 修改時間
filegroup — 取得文件的組
fileinode — 取得文件的 inode
filemtime — 取得文件修改時間
fileowner — 取得文件的所有者
fileperms — 取得文件的權限
filesize — 取得文件大小
filetype — 取得文件類型
flock — 輕便的咨詢文件鎖定
fnmatch — 用模式匹配文件名
fopen — 打開文件或者 URL
fpassthru — 輸出文件指針處的所有剩余數據
fputcsv — 將行格式化為 CSV 並寫入文件指針
fputs — fwrite() 的別名
fread — 讀取文件(可安全用於二進制文件)
fscanf — 從文件中格式化輸入
fseek — 在文件指針中定位
fstat — 通過已打開的文件指針取得文件信息
ftell — 返回文件指針讀/寫的位置
ftruncate — 將文件截斷到給定的長度
fwrite — 寫入文件(可安全用於二進制文件)
glob — 尋找與模式匹配的文件路徑
is_dir — 判斷給定文件名是否是一個目錄
is_executable — 判斷給定文件名是否可執行
is_file — 判斷給定文件名是否為一個正常的文件
is_link — 判斷給定文件名是否為一個符號連接
is_readable — 判斷給定文件名是否可讀
is_uploaded_file — 判斷文件是否是通過 HTTP POST 上傳的
is_writable — 判斷給定的文件名是否可寫
is_writeable — is_writable() 的別名
lchgrp — Changes group ownership of symlink
lchown — Changes user ownership of symlink
link — 建立一個硬連接
linkinfo — 獲取一個連接的信息
lstat — 給出一個文件或符號連接的信息
mkdir — 新建目錄
move_uploaded_file — 將上傳的文件移動到新位置
parse_ini_file — 解析一個配置文件
pathinfo — 返回文件路徑的信息
pclose — 關閉進程文件指針
popen — 打開進程文件指針
readfile — 輸出一個文件
readlink — 返回符號連接指向的目標
realpath — 返回規范化的絕對路徑名
rename — 重命名一個文件或目錄
rewind — 倒回文件指針的位置
rmdir — 刪除目錄
set_file_buffer — stream_set_write_buffer() 的別名
stat — 給出文件的信息
symlink — 建立符號連接
tempnam — 建立一個具有唯一文件名的文件
tmpfile — 建立一個臨時文件
touch — 設定文件的訪問和修改時間
umask — 改變當前的 umask
unlink — 刪除文件
mail — 發送郵件
abs — 絕對值
acos — 反余弦
acosh — 反雙曲余弦
asin — 反正弦
asinh — 反雙曲正弦
atan — 兩個參數的反正切
atan — 反正切
atanh — 反雙曲正切
base_convert — 在任意進制之間轉換數字
bindec — 二進制轉換為十進制
ceil — 進一法取整
cos — 余弦
cosh — 雙曲余弦
decbin — 十進制轉換為二進制
dechex — 十進制轉換為十六進制
decoct — 十進制轉換為八進制
degrad — 將角度轉換為弧度
exp — 計算 e 的指數
expm — 返回 exp(number) – 甚至當 number 的值接近零也能計算出准確結果
floor — 捨去法取整
fmod — 返回除法的浮點數余數
getrandmax — 顯示隨機數最大的可能值
hexdec — 十六進制轉換為十進制
hypot — 計算一直角三角形的斜邊長度
is_finite — 判斷是否為有限值
is_infinite — 判斷是否為無限值
is_nan — 判斷是否為合法數值
lcg_value — 組合線性同余發生器
log — 以 為底的對數
logp — 返回 log( + number)甚至當 number 的值接近零也能計算出准確結果
log — 自然對數
max — 找出最大值
min — 找出最小值
mt_getrandmax — 顯示隨機數的最大可能值
mt_rand — 生成更好的隨機數
mt_srand — 播下一個更好的隨機數發生器種子
octdec — 八進制轉換為十進制
pi — 得到圓周率值
pow — 指數表達式
raddeg — 將弧度數轉換為相應的角度數
rand — 產生一個隨機整數
round — 對浮點數進行四捨五入
sin — 正弦
sinh — 雙曲正弦
sqrt — 平方根
srand — 播下隨機數發生器種子
tan — 正切
tanh — 雙曲正切
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 — 發送一條 MySQL 查詢
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_lengths — 取得結果集中每個輸出的長度
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_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 結果中的字段
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 語句中使用的字符串中的特殊字符並考慮到連接的當前字符集
mysql_result — 取得結果數據
mysql_select_db — 選擇 MySQL 數據庫
mysql_stat — 取得當前系統狀態
mysql_tablename — 取得表名
mysql_thread_id — 返回當前線程的 ID
mysql_unbuffered_query — 向 MySQL 發送一條 SQL 查詢並不獲取和緩存結果的行
flush — 刷新輸出緩沖
ob_clean — Clean (erase) the output buffer
ob_end_clean — Clean (erase) the output buffer and turn off output buffering
ob_end_flush — Flush (send) the output buffer and turn off output buffering
ob_flush — Flush (send) the output buffer
ob_get_clean — Get current buffer contents and delete current output buffer
ob_get_contents — Return the contents of the output buffer
ob_get_flush — Flush the output buffer return it as a string and turn off output buffering
ob_get_length — Return the length of the output buffer
ob_get_level — Return the nesting level of the output buffering mechanism
ob_get_status — Get status of output buffers
ob_gzhandler — ob_start callback function to gzip output buffer
ob_implicit_flush — Turn implicit flush on/off
ob_list_handlers — List all output handlers in use
ob_start — Turn on output buffering
output_add_rewrite_var — Add URL rewriter values
output_reset_rewrite_vars — Reset URL rewriter values
preg_grep — 返回與模式匹配的數組單元
preg_last_error — Returns the error code of the last PCRE regex execution
preg_match_all — 進行全局正則表達式匹配
preg_match — 進行正則表達式匹配
preg_quote — 轉義正則表達式字符
preg_replace_callback — 用回調函數執行正則表達式的搜索和替換
preg_replace — 執行正則表達式的搜索和替換
preg_split — 用正則表達式分割字符串
session_cache_expire — Return current cache expire
session_cache_limiter — Get and/or set the current cache limiter
session_commit — session_write_close() 的別名
session_decode — Decodes session data from a string
session_destroy — Destroys all data registered to a session
session_encode — 將當前會話數據編碼為一個字符串
session_get_cookie_params — Get the session cookie parameters
session_id — Get and/or set the current session id
session_is_registered — Find out whether a global variable is registered in a session
session_module_name — Get and/or set the current session module
session_name — Get and/or set the current session name
session_regenerate_id — Update the current session id with a newly generated one
session_register — Register one or more global variables with the current session
session_save_path — Get and/or set the current session save path
session_set_cookie_params — Set the session cookie parameters
session_set_save_handler — Sets userlevel session storage functions
session_start — Initialize session data
session_unregister — Unregister a global variable from the current session
session_unset — Free all session variables
session_write_close — Write session data and end session
ereg_replace — 正則表達式替換
ereg — 正則表達式匹配
eregi_replace — 不區分大小寫的正則表達式替換
eregi — 不區分大小寫的正則表達式匹配
split — 用正則表達式將字符串分割到數組中
spliti — 用正則表達式不區分大小寫將字符串分割到數組中
sql_regcase — 產生用於不區分大小的匹配的正則表達式
addcslashes — 以 C 語言風格使用反斜線轉義字符串中的字符
addslashes — 使用反斜線引用字符串
binhex — 將二進制數據轉換成十六進制表示
chop — rtrim() 的別名
chr — 返回指定的字符
chunk_split — 將字符串分割成小塊
count_chars — 返回字符串所用字符的信息
crc — 計算一個字符串的 crc 多項式
crypt — Oneway string encryption (hashing)
echo — Output one or more strings
explode — 使用一個字符串分割另一個字符串
fprintf — Write a formatted string to a stream
get_html_translation_table — Returns the translation table used by htmlspecialchars() and htmlentities()
hebrev — Convert logical Hebrew text to visual text
hebrevc — Convert logical Hebrew text to visual text with newline conversion
html_entity_decode — Convert all HTML entities to their applicable characters
htmlentities — Convert all applicable characters to HTML entities
htmlspecialchars_decode — Convert special HTML entities back to characters
htmlspecialchars — Convert special characters to HTML entities
implode — Join array elements with a string
join — 別名 implode()
levenshtein — Calculate Levenshtein distance between two strings
localeconv — Get numeric formatting information
ltrim — Strip whitespace (or other characters) from the beginning of a string
md_file — Calculates the md hash of a given file
md — Calculate the md hash of a string
metaphone — Calculate the metaphone key of a string
money_format — Formats a number as a currency string
nl_langinfo — Query language and locale information
nlbr — Inserts HTML line breaks before all newlines in a string
number_format — Format a number with grouped thousands
ord — Return ASCII value of character
parse_str — Parses the string into variables
print — Output a string
printf — Output a formatted string
quoted_printable_decode — Convert a quotedprintable string to an bit string
quotemeta — Quote meta characters
rtrim — Strip whitespace (or other characters) from the end of a string
setlocale — Set locale information
sha_file — Calculate the sha hash of a file
sha — Calculate the sha hash of a string
similar_text — Calculate the similarity between two strings
soundex — Calculate the soundex key of a string
sprintf — Return a formatted string
sscanf — Parses input from a string according to a format
str_getcsv — Parse a CSV string into an array
str_ireplace — Caseinsensitive version of str_replace()
str_pad — Pad a string to a certain length with another string
str_repeat — Repeat a string
str_replace — Replace all occurrences of the search string with the replacement string
str_rot — Perform the rot transform on a string
str_shuffle — Randomly shuffles a string
str_split — Convert a string to an array
str_word_count — Return information about words used in a string
strcasecmp — Binary safe caseinsensitive string comparison
strchr — 別名 strstr()
strcmp — Binary safe string comparison
strcoll — Locale based string comparison
strcspn — Find length of initial segment not matching mask
strip_tags — Strip HTML and PHP tags from a string
stripcslashes — Unquote string quoted with addcslashes()
stripos — Find position of first occurrence of a caseinsensitive string
stripslashes — Unquote string quoted with addslashes()
stristr — Caseinsensitive strstr()
strlen — Get string length
strnatcasecmp — Case insensitive string comparisons using a “natural order” algorithm
strnatcmp — String comparisons using a “natural order” algorithm
strncasecmp — Binary safe caseinsensitive string comparison of the first n characters
strncmp — Binary safe string comparison of the first n characters
strpbrk — Search a string for any of a set of characters
strpos — Find position of first occurrence of a string
strrchr — Find the last occurrence of a character in a string
strrev — Reverse a string
strripos — Find position of last occurrence of a caseinsensitive string in a string
strrpos — Find position of last occurrence of a char in a string
strspn — Find length of initial segment matching mask
strstr — Find first occurrence of a string
strtok — Tokenize string
strtolower — Make a string lowercase
strtoupper — Make a string uppercase
strtr — Translate certain characters
substr_compare — Binary safe optionally case insensitive comparison of strings from an offset up to length characters
substr_count — Count the number of substring occurrences
substr_replace — Replace text within a portion of a string
substr — Return part of a string
trim — Strip whitespace (or other characters) from the beginning and end of a string
ucfirst — Make a strings first character uppercase
ucwords — Uppercase the first character of each word in a string
vfprintf — Write a formatted string to a stream
vprintf — Output a formatted string
vsprintf — Return a formatted string
wordwrap — Wraps a string to a given number of characters using a string break character
base_decode — 對使用 MIME base 編碼的數據進行解碼
base_encode — 使用 MIME base 對數據進行編碼
get_headers — 取得服務器響應一個 HTTP 請求所發送的所有標頭
get_meta_tags — 從一個文件中提取所有的 meta 標簽 content 屬性返回一個數組
http_build_query — 生成 URLencode 之後的請求字符串
parse_url — 解析 URL返回其組成部分
rawurldecode — 對已編碼的 URL 字符串進行解碼
rawurlencode — 按照 RFC 對 URL 進行編碼
urldecode — 解碼已編碼的 URL 字符串
urlencode — 編碼 URL 字符串
debug_zval_dump — Dumps a string representation of an internal zend value to output
doubleval — floatval() 的別名
empty — 檢查一個變量是否為空
floatval — 獲取變量的浮點值
get_defined_vars — 返回由所有已定義變量所組成的數組
get_resource_type — 返回資源(resource)類型
gettype — 獲取變量的類型
import_request_variables — 將 GET/POST/Cookie 變量導入到全局作用域中
intval — 獲取變量的整數值
is_array — 檢測變量是否是數組
is_binary — Finds whether a variable is a native binary string
is_bool — 檢測變量是否是布爾型
is_buffer — Finds whether a variable is a native unicode or binary string
is_callable — 檢測參數是否為合法的可調用結構
is_double — is_float() 的別名
is_float — 檢測變量是否是浮點型
is_int — 檢測變量是否是整數
is_integer — is_int() 的別名
is_long — is_int() 的別名
is_null — 檢測變量是否為 NULL
is_numeric — 檢測變量是否為數字或數字字符串
is_object — 檢測變量是否是一個對象
is_real — is_float() 的別名
is_resource — 檢測變量是否為資源類型
is_scalar — 檢測變量是否是一個標量
is_string — 檢測變量是否是字符串
is_unicode — Finds whether a variable is a unicode string
isset — 檢測變量是否設置
print_r — 打印關於變量的易於理解的信息
serialize — 產生一個可存儲的值的表示
settype — 設置變量的類型
strval — 獲取變量的字符串值
unserialize — 從已存儲的表示中創建 PHP 的值
unset — 釋放給定的變量
var_dump — 打印變量的相關信息
var_export — 輸出或返回一個變量的字符串表示


From:http://tw.wingwit.com/Article/program/PHP/201311/21080.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.