2017-02-13-php-function-reference

layouttitledescriptionkeywordscategorytags
post
PHP函数参考-核心扩展库
php,手册
php,手册,语法
php
php

02-核心扩展库

PHP官方手册主要包含了四大部分为了便于查阅进行整理总结,本篇主要是第二部分函数参考。

核心扩展库

1. 字符串

  • addcslashes Quote string with slashes in a C style
  • addslashes Quote string with slashes
  • bin2hex Convert binary data into hexadecimal representation
  • chop Alias of rtrim
  • chr Return a specific character
  • chunk_split Split a string into smaller chunks
  • convert_cyr_string Convert from one Cyrillic character set to another
  • convert_uudecode Decode a uuencoded string
  • convert_uuencode Uuencode a string
  • count_chars Return information about characters used in a string
  • crc32 Calculates the crc32 polynomial of a string
  • crypt One-way string hashing
  • echo Output one or more strings
  • explode Split a string by string
  • 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
  • hex2bin Decodes a hexadecimally encoded binary string
  • 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 Alias of implode
  • lcfirst Make a string's first character lowercase
  • levenshtein Calculate Levenshtein distance between two strings
  • localeconv Get numeric formatting information
  • ltrim Strip whitespace (or other characters) from the beginning of a string
  • md5_file Calculates the md5 hash of a given file
  • md5 Calculate the md5 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
  • nl2br 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 quoted-printable string to an 8 bit string
  • quoted_printable_encode Convert a 8 bit string to a quoted-printable string
  • quotemeta Quote meta characters
  • rtrim Strip whitespace (or other characters) from the end of a string
  • setlocale Set locale information
  • sha1_file Calculate the sha1 hash of a file
  • sha1 Calculate the sha1 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 Case-insensitive 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_rot13 Perform the rot13 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 case-insensitive string comparison
  • strchr Alias of 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 Un-quote string quoted with addcslashes
  • stripos Find the position of the first occurrence of a case-insensitive substring in a string
  • stripslashes Un-quotes a quoted string
  • stristr Case-insensitive 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 case-insensitive 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 the position of the first occurrence of a substring in a string
  • strrchr Find the last occurrence of a character in a string
  • strrev Reverse a string
  • strripos Find the position of the last occurrence of a case-insensitive substring in a string
  • strrpos Find the position of the last occurrence of a substring in a string
  • strspn Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask.
  • strstr Find the first occurrence of a string
  • strtok Tokenize string
  • strtolower Make a string lowercase
  • strtoupper Make a string uppercase
  • strtr Translate characters or replace substrings
  • substr_compare Binary safe comparison of two 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 string's 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

2. 数组

  • array_change_key_case Changes the case of all keys in an array
  • array_chunk Split an array into chunks
  • array_column Return the values from a single column in the input array
  • array_combine Creates an array by using one array for keys and another for its values
  • array_count_values Counts all the values of an array
  • array_diff_assoc Computes the difference of arrays with additional index check
  • array_diff_key Computes the difference of arrays using keys for comparison
  • array_diff_uassoc Computes the difference of arrays with additional index check which is performed by a user supplied callback function
  • array_diff_ukey Computes the difference of arrays using a callback function on the keys for comparison
  • array_diff Computes the difference of arrays
  • array_fill_keys Fill an array with values, specifying keys
  • array_fill Fill an array with values
  • array_filter Filters elements of an array using a callback function
  • array_flip Exchanges all keys with their associated values in an array
  • array_intersect_assoc Computes the interp of arrays with additional index check
  • array_intersect_key Computes the interp of arrays using keys for comparison
  • array_intersect_uassoc Computes the interp of arrays with additional index check, compares indexes by a callback function
  • array_intersect_ukey Computes the interp of arrays using a callback function on the keys for comparison
  • array_intersect Computes the interp of arrays
  • array_key_exists Checks if the given key or index exists in the array
  • array_keys Return all the keys or a subset of the keys of an array
  • array_map Applies the callback to the elements of the given arrays
  • array_merge_recursive Merge two or more arrays recursively
  • array_merge Merge one or more arrays
  • array_multisort Sort multiple or multi-dimensional arrays
  • array_pad Pad array to the specified length with a value
  • array_pop Pop the element off the end of array
  • array_product Calculate the product of values in an array
  • array_push Push one or more elements onto the end of array
  • array_rand Pick one or more random entries out of an array
  • array_reduce Iteratively reduce the array to a single value using a callback function
  • array_replace_recursive Replaces elements from passed arrays into the first array recursively
  • array_replace Replaces elements from passed arrays into the first array
  • array_reverse Return an array with elements in reverse order
  • array_search Searches the array for a given value and returns the first corresponding key if successful
  • array_shift Shift an element off the beginning of array
  • array_slice Extract a slice of the array
  • array_splice Remove a portion of the array and replace it with something else
  • array_sum Calculate the sum of values in an array
  • array_udiff_assoc Computes the difference of arrays with additional index check, compares data by a callback function
  • array_udiff_uassoc Computes the difference of arrays with additional index check, compares data and indexes by a callback function
  • array_udiff Computes the difference of arrays by using a callback function for data comparison
  • array_uintersect_assoc Computes the interp of arrays with additional index check, compares data by a callback function
  • array_uintersect_uassoc Computes the interp of arrays with additional index check, compares data and indexes by separate callback functions
  • array_uintersect Computes the interp of arrays, compares data by a callback function
  • array_unique Removes duplicate values from an array
  • array_unshift Prepend one or more elements to the beginning of an array
  • array_values Return all the values of an array
  • array_walk_recursive Apply a user function recursively to every member of an array
  • array_walk Apply a user supplied function to every member of an array
  • array Create an array
  • arsort Sort an array in reverse order and maintain index association
  • asort Sort an array and maintain index association
  • compact Create array containing variables and their values
  • count Count all elements in an array, or something in an object
  • current Return the current element in an array
  • each Return the current key and value pair from an array and advance the array cursor
  • end Set the internal pointer of an array to its last element
  • extract Import variables into the current symbol table from an array
  • in_array Checks if a value exists in an array
  • key_exists Alias of array_key_exists
  • key Fetch a key from an array
  • krsort Sort an array by key in reverse order
  • ksort Sort an array by key
  • list Assign variables as if they were an array
  • natcasesort Sort an array using a case insensitive "natural order" algorithm
  • natsort Sort an array using a "natural order" algorithm
  • next Advance the internal array pointer of an array
  • pos Alias of current
  • prev Rewind the internal array pointer
  • range Create an array containing a range of elements
  • reset Set the internal pointer of an array to its first element
  • rsort Sort an array in reverse order
  • shuffle Shuffle an array
  • sizeof Alias of count
  • sort Sort an array
  • uasort Sort an array with a user-defined comparison function and maintain index association
  • uksort Sort an array by keys using a user-defined comparison function
  • usort Sort an array by values using a user-defined comparison function

3. 类/对象

4. 日期/时间

5. 目录

  • chdir Change directory
  • chroot Change the root directory
  • closedir Close directory handle
  • dir Return an instance of the Directory class
  • getcwd Gets the current working directory
  • opendir Open directory handle
  • readdir Read entry from directory handle
  • rewinddir Rewind directory handle
  • scandir List files and directories inside the specified path

6. 错误处理

7. 程序执行

  • escapeshellarg Escape a string to be used as a shell argument
  • escapeshellcmd Escape shell metacharacters
  • exec Execute an external program
  • passthru Execute an external program and display raw output
  • proc_close Close a process opened by proc_open and return the exit code of that process
  • proc_get_status Get information about a process opened by proc_open
  • proc_nice Change the priority of the current process
  • proc_open Execute a command and open file pointers for input/output
  • proc_terminate Kills a process opened by proc_open
  • shell_exec Execute command via shell and return the complete output as a string
  • system Execute an external program and display the output

8. Filesystem

9. Filter

10. Function Handing

11. Hash

  • hash_algos Return a list of registered hashing algorithms
  • hash_copy Copy hashing context
  • hash_equals Timing attack safe string comparison
  • hash_file Generate a hash value using the contents of a given file
  • hash_final Finalize an incremental hash and return resulting digest
  • hash_hmac_file Generate a keyed hash value using the HMAC method and the contents of a given file
  • hash_hmac Generate a keyed hash value using the HMAC method
  • hash_init Initialize an incremental hashing context
  • hash_pbkdf2 Generate a PBKDF2 key derivation of a supplied password
  • hash_update_file Pump data into an active hashing context from a file
  • hash_update_stream Pump data into an active hashing context from an open stream
  • hash_update Pump data into an active hashing context
  • hash Generate a hash value (message digest)

12. PHP 选项/信息

13. Mail

14. Math

  • abs Absolute value
  • acos Arc cosine
  • acosh Inverse hyperbolic cosine
  • asin Arc sine
  • asinh Inverse hyperbolic sine
  • atan2 Arc tangent of two variables
  • atan Arc tangent
  • atanh Inverse hyperbolic tangent
  • base_convert Convert a number between arbitrary bases
  • bindec Binary to decimal
  • ceil Round fractions up
  • cos Cosine
  • cosh Hyperbolic cosine
  • decbin Decimal to binary
  • dechex Decimal to hexadecimal
  • decoct Decimal to octal
  • deg2rad Converts the number in degrees to the radian equivalent
  • exp Calculates the exponent of e
  • expm1 Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
  • floor Round fractions down
  • fmod Returns the floating point remainder (modulo) of the division of the arguments
  • getrandmax Show largest possible random value
  • hexdec Hexadecimal to decimal
  • hypot Calculate the length of the hypotenuse of a right-angle triangle
  • intdiv Integer division
  • is_finite Finds whether a value is a legal finite number
  • is_infinite Finds whether a value is infinite
  • is_nan Finds whether a value is not a number
  • lcg_value Combined linear congruential generator
  • log10 Base-10 logarithm
  • log1p Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
  • log Natural logarithm
  • max Find highest value
  • min Find lowest value
  • mt_getrandmax Show largest possible random value
  • mt_rand Generate a better random value
  • mt_srand Seed the better random number generator
  • octdec Octal to decimal
  • pi Get value of pi
  • pow Exponential expression
  • rad2deg Converts the radian number to the equivalent number in degrees
  • rand Generate a random integer
  • round Rounds a float
  • sin Sine
  • sinh Hyperbolic sine
  • sqrt Square root
  • srand Seed the random number generator
  • tan Tangent
  • tanh Hyperbolic tangent

15. Misc

16. 网络

17. 输出控制

18. Password Hashing

19. Session

20. 反射

21. POSIX Regex

  • ereg_replace Replace regular expression
  • ereg Regular expression match
  • eregi_replace Replace regular expression case insensitive
  • eregi Case insensitive regular expression match
  • split Split string into array by regular expression
  • spliti Split string into array by regular expression case insensitive
  • sql_regcase Make regular expression for case insensitive matche

22. SPL

23. Streams

24. Tokenizer

25. URLs

26. Variable Handing

  • boolval Get the boolean value of a variable
  • debug_zval_dump Dumps a string representation of an internal zend value to output
  • doubleval Alias of floatval
  • empty Determine whether a variable is empty
  • floatval Get float value of a variable
  • get_defined_vars Returns an array of all defined variables
  • get_resource_type Returns the resource type
  • gettype Get the type of a variable
  • import_request_variables Import GET/POST/Cookie variables into the global scope
  • intval Get the integer value of a variable
  • is_array Finds whether a variable is an array
  • is_bool Finds out whether a variable is a boolean
  • is_callable Verify that the contents of a variable can be called as a function
  • is_double Alias of is_float
  • is_float Finds whether the type of a variable is float
  • is_int Find whether the type of a variable is integer
  • is_integer Alias of is_int
  • is_long Alias of is_int
  • is_null Finds whether a variable is NULL
  • is_numeric Finds whether a variable is a number or a numeric string
  • is_object Finds whether a variable is an object
  • is_real Alias of is_float
  • is_resource Finds whether a variable is a resource
  • is_scalar Finds whether a variable is a scalar
  • is_string Find whether the type of a variable is string
  • isset Determine if a variable is set and is not NULL
  • print_r Prints human-readable information about a variable
  • serialize Generates a storable representation of a value
  • settype Set the type of a variable
  • strval Get string value of a variable
  • unserialize Creates a PHP value from a stored representation
  • unset Unset a given variable
  • var_dump Dumps information about a variable
  • var_export Outputs or returns a parsable string representation of a variable
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值