
PHP function reference table
function | detailed explanation |
---|---|
trim | delete spaces or other predefined characters at both ends of a string |
rtrim | delete the space or other predefined characters on the right side of the string |
chop | alias for rtrim()chop() is different from perl's chop() function, which deletes the last character of the string. |
ltrim | delete the space or other predefined characters on the left side of the string |
function | detailed explanation |
---|---|
str_pad | use another string to fill the string for the specified length |
str_split | convert strings to arrays |
strrev | invert string |
wordwrap | break string to a specified number of strings |
str_shuffle | randomly disrupt a string |
parse_str | parses strings into variables |
number_format | format strings by thousand-bit grouping |
function | detailed explanation |
---|---|
strtolower | convert string to lowercase |
strtoupper/td> | convert string to uppercase |
ucfirst | convert the initial letter of a string to uppercase |
lcfirst | convert the first letter of a string to lowercase |
ucwords | convert the first letter of each word in the string to uppercase |
function | detailed explanation |
---|---|
htmlentities | convert characters to html entities |
htmlspecialchars | predefined string to html encoding |
nl2br | insert html newline tag before all new lines of a string \nconvert to tags |
strip_tags | remove html and php tags from strings |
addcslashes | escape characters in a string using backslashes in c style |
stripcslashes | anti-reference a string escaped using addcslashes() |
addslashes | referring strings with backslash |
stripslashes | remove escaped characters added by addslashes |
quotemeta | some predefined strings in strings are preceded by backslashes |
chr | returns characters from specified ascii value |
ord | returns the ascii value of the first character of the string |
function | detailed explanation |
---|---|
strcasecmp | comparison of two strings insensitively |
strcmp | comparison of two strings case sensitive |
strncmp | compare the first n characters of the string, case sensitive |
strncasecmp | compare the first n characters of the string, case-insensitive |
strnatcmp | comparison of string lengths in natural order, case-sensitive |
strnatcasecmp | natural order method compares string lengths, case-insensitive |
function | detailed explanation |
---|---|
str_replace | string replacement operation, case sensitive |
str_ireplace | string replacement operation, case-insensitive |
substr_count | count the number of times a string appears in another string |
substr_replace | replace a string in the string as another string |
similar_text | returns the number of characters of the same string |
strrchr | returns the string from the last occurrence of a string in another string to the end |
strstr | returns a string from the start position to the end position of one string in another string |
strchr | alias for strstr, returns the string from the first occurrence of a string in another, starting from the end of the first occurrence of a string in another |
stristr | returns a string from the start position to the end position in another string, case-insensitive |
strtr | convert certain characters in a string |
strpos | find the first location of certain characters in a character |
stripos | find the first location of certain characters in characters, case-insensitive |
strrpos | find the last location of certain characters in the character |
strripos | find the last location of certain characters in characters, case-insensitive |
strspn | returns the length of the string in the string that matches the mask for the first time |
strcspn | returns the length of a string in the string that does not match the mask |
function | detailed explanation |
---|---|
str_word_count | statistics the number of words contained in a string |
strlen | statistics string length |
count_chars | statistics the number of times all letters appear in a string (0..255) |
function | detailed explanation |
---|---|
md5 | calculate the md5 hash value of a string |
hash | generate a hash code |
function | detailed explanation |
---|---|
array | generate an array |
array_combine | generate an array, using the value of one array as the key name and the value of another array as the value |
range | creates and returns an array of elements with specified ranges |
compact | create an array of variables with parameters |
array_fill | fill the given value to generate an array |
function | detailed explanation |
---|---|
array_chunk | split an array into new array blocks |
array_merge | combine two or more arrays |
array_slice | take out a segment of the value in the array according to the conditions and return it. |
function | detailed explanation |
---|---|
array_diff | returns the difference array of two arrays |
array_intersect | returns an array of intersections of two or more arrays |
function | detailed explanation |
---|---|
array_search | find a key value in an array |
array_splice | delete part of the array and replace other values |
array_sum | returns the sum of all values in the array |
in_array | search for specified values in arrays, case sensitive |
array_key_exists | determines whether the specified key exists in an array |
function | detailed explanation |
---|---|
key | returns the key name currently pointed to by the internal pointer of the array |
current | returns the current element in the array |
next | move the pointer to the current element to the next element position and return the value of the current element |
prev | move the pointer to the current element to the previous element position and return the value of the current element |
end | point the inner pointer of the array to the last element and return the value of that element (if successful) |
reset | point the inner pointer of the array to the first element and return the value of that element |
list | assign values to a set of variables using elements in an array |
array_shift | delete the first element in the array and return the value of the deleted element |
array_unshift | insert one or more elements at the beginning of the array |
array_push | press one or more elements into the last array |
array_pop | delete the last element of the array |
function | detailed explanation |
---|---|
shuffle | breaking the array and keeping the key name |
count | calculate the number of units or object attributes in an array |
array_flip | returns an array after the key value is flipped |
array_keys | return all keys in the array to form an array |
array_values | return all values in the array to form an array |
array_reverse | return an array of elements in the opposite order |
array_count_values | statistics the number of times all values appear in the array |
array_rand | randomly extract one or more elements from the array, note that it is the key name |
each | return the current key/value pair in the array and move the array pointer one step forward |
array_unique | remove duplicate values from the array |
function | detailed explanation |
---|---|
sort | sort arrays |
rsort | reverse sorting of arrays |
asort | sort the array and maintain index relationships |
arsort | reversely sort the array and maintain index relationships |
ksort | sort arrays by key names |
krsort | reversely sort the array by key name |
natsort | sort arrays using the "natural sort" algorithm |
natcasesort | use the "natural sorting" algorithm to sort the array case-insensitive letters |
function | detailed explanation |
---|---|
abs | find the absolute value |
ceil | further method of sorting |
floor | leave the method of sorting |
fmod | returns the remainder of the floating point number of division |
pow | return to the n-power of the number |
round | floating point rounding method |
sqrt | find the square root |
max | find the maximum value |
min | find the minimum value |
mt_rand | better random numbers |
rand | random number |
pi | obtain pi |
octdec | convert octal to decimal |
function | detailed explanation |
---|---|
mysql_affected_rows | get the number of records affected by the previous mysql operation |
mysql_client_encoding | returns the name of the character set |
mysql_close | close mysql connection |
mysql_connect | open a connection to the mysql server |
mysql_create_db | create a new mysql database |
mysql_data_seek | move internal result pointer |
mysql_db_name | obtain result data |
mysql_db_query | send a mysql query |
mysql_drop_db | discard (delete) a mysql database |
mysql_errno | returns the numeric encoding of error messages in the previous mysql operation |
mysql_error | returns the text error message generated by the previous mysql operation |
mysql_escape_string | escape a string for mysql_query |
mysql_fetch_array | get a row from the result set as an associative array, or an array of numbers, or both |
mysql_fetch_assoc | get a row from the result set as an associative array |
mysql_fetch_field | get column information from the result set and return as an object |
mysql_fetch_lengths | get the length of each output in the result set |
mysql_fetch_object | get a row from the result set as an object |
mysql_fetch_row | get a row from the result set as an enumeration array |
mysql_field_flags | get flags associated with the specified field from the result |
mysql_field_len | returns the length of the specified field |
mysql_field_name | get the field name of the specified field in the result |
mysql_field_seek | set the pointer in the result set to the defined field offset |
mysql_field_table | get the table name where the specified field is located |
mysql_field_type | get the type of the specified field in the result set |
mysql_free_result | free result memory |
mysql_get_client_info | obtain mysql client information |
mysql_get_host_info | obtain mysql host information |
mysql_get_proto_info | obtain mysql protocol information |
mysql_get_server_info | obtain mysql server information |
mysql_info | get the latest query information |
mysql_insert_id | obtain the id generated by the previous insert operation |
mysql_list_dbs | list all databases in mysql server |
mysql_list_fields | list fields in mysql results |
mysql_list_processes | list mysql processes |
mysql_list_tables | list tables in mysql database |
mysql_num_fields | get the number of fields in the result set |
mysql_num_rows | get the number of rows in the result set |
mysql_pconnect | open a persistent connection to the mysql server |
mysql_ping | ping a server connection, if there is no connection, reconnect |
mysql_query | send a mysql query |
mysql_real_escape_string | escape special characters in strings used in sql statements and take into account the current character set of the concatenation |
mysql_result | obtain result data |
mysql_select_db | select mysql database |
mysql_set_charset | Sets the client character set |
mysql_stat | get the current system status |
mysql_tablename | obtain the table name |
mysql_thread_id | return the id of the current thread |
mysql_unbuffered_query | send a sql query to mysql, and rows that do not get and cache the result |
function | detailed explanation |
---|---|
basename | returns the file name part in the path |
chgrp | change the group to which the file belongs |
chmod | change file mode |
chown | change the owner of the file |
clearstatcache | clear file status cache |
copy | copy the file |
delete | see unlink or unset |
dirname | return to the directory part in the path |
disk_free_space | returns the available space in the directory |
disk_total_space | returns the total disk size of a directory |
diskfreespace | alias for disk_free_space |
fclose | close an open file pointer |
feof | test whether the file pointer reaches the end of the file |
fflush | output buffered content to file |
fgetc | read characters from file pointer |
fgetcsv | read a line from the file pointer and parse the csv field |
fgets | read a line from a file pointer |
fgetss | read a line from a file pointer and filter out html tags |
file_exists | check if the file or directory exists |
file_get_contents | read the entire file into a string |
file_put_contents | write a string to a file |
file | read the entire file into an array |
fileatime | get the last access time of the file |
filectime | get the inode modification time of the file |
filegroup | group of files obtained |
fileinode | get the inode of the file |
filemtime | get file modification time |
fileowner | obtain the owner of the document |
fileperms | obtain permissions to files |
filesize | get file size |
filetype | get file type |
flock | lightweight consultation file locking |
fnmatch | match file names with pattern |
fopen | open a file or url |
fpassthru | all remaining data at the output file pointer |
fputcsv | format the line to csv and write to the file pointer |
fputs | alias for fwrite |
fread | read files (safely used in binary files) |
fscanf | format input from a file |
fseek | positioning in file pointer |
fstat | get file information through the opened file pointer |
ftell | returns the location where the file pointer is read/write |
ftruncate | truncate the file to a given length |
fwrite | write to files (safely used in binary files) |
glob | find file paths that match patterns |
is_dir | determine whether the given file name is a directory |
is_executable | determine whether the given file name is executable |
is_file | determine whether the given file name is a normal file |
is_link | determine whether the given file name is a symbolic connection |
is_readable | determine whether the given file name is readable |
is_uploaded_file | determine whether the file is uploaded through http post |
is_writable | determine whether the given file name is writable |
is_writeable | is_writable alias |
lchgrp | Changes group ownership of symlink |
lchown | Changes user ownership of symlink |
link | create a hard connection |
linkinfo | get information about a connection |
lstat | give information about a file or symbol connection |
md5_file | calculate the md5 hash of the file |
mkdir | create a new directory |
move_uploaded_file | move uploaded files to a new location |
parse_ini_file | parse a configuration file |
parse_ini_string | Parse a configuration string |
pathinfo | returns the file path information |
pclose | close process file pointer |
popen | open process file pointer |
readfile | output a file |
readlink | returns the target pointed to by the symbolic connection |
realpath_cache_get | Get realpath cache entries |
realpath_cache_size | Get realpath cache size |
realpath | returns the normalized absolute path name |
rename | rename a file or directory |
rewind | rewind the file pointer position |
rmdir | delete directory |
set_file_buffer | alias for stream_set_write_buffer |
stat | give the information about the file |
symlink | establish symbolic connection |
tempnam | create a file with a unique file name |
tmpfile | create a temporary file |
touch | set file access and modification time |
umask | change the current umask |
unlink | delete files |
function | detailed explanation |
---|---|
gd_info | get information about the currently installed gd library |
getimagesize | get image size |
getimagesizefromstring | Get the size of an image from a string |
image_type_to_extension | get the file suffix of the image type |
image_type_to_mime_type | get the mime type of the image type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype |
image2wbmp | output images to browser or file in wbmp format |
imagealphablending | set the image color mixing mode |
imageantialias | whether to use antialias function |
imagearc | draw an elliptical arc |
imagechar | draw a character horizontally |
imagecharup | draw a character vertically |
imagecolorallocate | assign color to an image |
imagecolorallocatealpha | assign color to an image + alpha |
imagecolorat | get the color index value of a certain pixel |
imagecolorclosest | gets the index value of the color closest to the specified color |
imagecolorclosestalpha | get the color closest to the specified color plus transparency |
imagecolorclosesthwb | get the black and white index of the chromaticity closest to the given color |
imagecolordeallocate | cancel the image color assignment |
imagecolorexact | get the index value of the specified color |
imagecolorexactalpha | get the index value of the specified color plus transparency |
imagecolormatch | make the color of the palette version in an image better match the true color version |
imagecolorresolve | get the index value of the specified color or the closest alternative value that is possible |
imagecolorresolvealpha | get the index value of the specified color + alpha or the closest alternative value that is possible |
imagecolorset | set color for the specified palette index |
imagecolorsforindex | get the color of an index |
imagecolorstotal | get the number of colors in the palette of an image |
imagecolortransparent | define a color as transparent |
imageconvolution | use coefficients div and offset to apply for a 3x3 convolution matrix |
imagecopy | copy part of the image |
imagecopymerge | copy and merge part of the image |
imagecopymergegray | copy and merge part of the image in grayscale |
imagecopyresampled | resample and copy part of the image and resize it |
imagecopyresized | copy some images and resize them |
imagecreate | create a new palette-based image |
imagecreatefromgd2 | create a new image from a gd2 file or url |
imagecreatefromgd2part | create a new image from a part of the given gd2 file or url |
imagecreatefromgd | create a new image from a gd file or url |
imagecreatefromgif | create a new image from a file or url |
imagecreatefromjpeg | create a new image from a file or url |
imagecreatefrompng | create a new image from a file or url |
imagecreatefromstring | create a new image from the image stream in a string |
imagecreatefromwbmp | create a new image from a file or url |
imagecreatefromxbm | create a new image from a file or url |
imagecreatefromxpm | create a new image from a file or url |
imagecreatetruecolor | create a new true color image |
imagedashedline | draw a dotted line |
imagedestroy | destroy an image |
imageellipse | draw an ellipse |
imagefill | area filling |
imagefilledarc | draw an ellipse and fill it |
imagefilledellipse | draw an ellipse and fill it |
imagefilledpolygon | draw a polygon and fill it |
imagefilledrectangle | draw a rectangle and fill it |
imagefilltoborder | the area is filled to the boundary of the specified color |
imagefilter | use filters for images |
imagefontheight | get font height |
imagefontwidth | get font width |
imageftbbox | given a text box using freetype 2 font |
imagefttext | write text to images using freetype 2 font |
imagegammacorrect | apply gamma correction to gd images |
imagegd2 | output gd2 images to a browser or file |
imagegd | output gd images to browser or file |
imagegif | output image to browser or file |
imagegrabscreen | Captures the whole screen |
imagegrabwindow | Captures a window |
imageinterlace | activate or disable interlacing |
imageistruecolor | check if the image is true color image |
imagejpeg | output image to browser or file |
imagelayereffect | set the alpha color mixing logo to use the bound libgd layering effect |
imageline | draw a line segment |
imageloadfont | load a new font |
imagepalettecopy | copy the color palette from one image to another |
imagepng | output images to browser or file in png format |
imagepolygon | draw a polygon |
imagepsbbox | given a text box using postscript type1 font |
imagepsencodefont | change character encoding vector in font |
imagepsextendfont | extend or streamline fonts |
imagepsfreefont | free up a postscript type 1 font memory |
imagepsloadfont | load a postscript type 1 font from a file |
imagepsslantfont | tilt a certain font |
imagepstext | draw text strings on images using postscript type1 font |
imagerectangle | draw a rectangle |
imagerotate | rotate the image at a given angle |
imagesavealpha | set the marker to save the full alpha channel information when saving png images (as opposed to a single transparent hue) |
imagesetbrush | set the image of the brush for drawing lines |
imagesetpixel | draw a single pixel |
imagesetstyle | set the style of drawing lines |
imagesetthickness | set the width of the line drawing |
imagesettile | set the map for filling |
imagestring | draw a line of string horizontally |
imagestringup | draw a line of strings vertically |
imagesx | get image width |
imagesy | obtain image height |
imagetruecolortopalette | convert true color images to palette images |
imagettfbbox | get the range of text using truetype fonts |
imagettftext | write text to images using truetype font |
imagetypes | returns the image type supported by the current php version |
imagewbmp | output images to browser or file in wbmp format |
imagexbm | output xbm images to a browser or file |
iptcembed | embed binary iptc data into a jpeg image |
iptcparse | resolve binary iptc blocks at http://www.iptc.org/ to a single tag |
jpeg2wbmp | convert jpeg image files to wbmp image files |
png2wbmp | convert png image files to wbmp image files |
function | detailed explanation |
---|---|
session_cache_expire | return to the current cache expiration |
session_cache_limiter | get and set the current cache limit/gold |
session_commit | alias for session_write_close |
session_decode | encode session data from a session-encoded string |
session_destroy | destroy all data registered to the session |
session_encode | encode the current session data into a string |
session_get_cookie_params | obtain session cookie parameters |
session_id | get and/or set the current session identifier |
session_is_registered | check if the variable is registered in the session |
session_module_name | obtain and/or set the current session module |
session_name | get and/or set the current session name |
session_regenerate_id | update the newly generated session identifier |
session_register_shutdown | session shutdown function |
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 session cookie parameters |
session_set_save_handler | set user-level session storage function |
session_start | start a new or resume an existing session |
session_status | return to the current session status |
session_unregister | log out of a global variable for the current session |
session_unset | free all session variables |
session_write_close | write session data and end session |
function | detailed explanation |
---|---|
setcookie() | set cookies |
setrawcookie | send cookies without url encoding |
function | detailed explanation |
---|---|
checkdate | verify a gregory date |
date_add | alias datetime::add |
date_create_from_format | alias datetime::createfromformat |
date_create | alias datetime::__construct |
date_date_set | alias datetime::setdate |
date_default_timezone_get | get the default time zone used by all date and time functions in a script |
date_default_timezone_set | set the default time zone for all date and time functions in a script |
date_diff | alias datetime::diff |
date_format | alias datetime::format |
date_get_last_errors | alias datetime::getlasterrors |
date_interval_create_from_date_string | alias dateinterval::createfromdatestring |
date_interval_format | alias dateinterval::format |
date_isodate_set | alias datetime::setisodate |
date_modify | alias datetime::modify |
date_offset_get | alias datetime::getoffset |
date_parse_from_format | Get info about given date formatted according to the specified format |
date_parse | Returns associative array with detailed info about given date |
date_sub | alias datetime::sub |
date_sun_info | Returns an array with information about sunset/sunrise and twilight begin/end |
date_sunrise | returns the given date and place of sunrise time |
date_sunset | returns the given date and place of sunset time |
date_time_set | alias datetime::settime |
date_timestamp_get | alias datetime::gettimestamp |
date_timestamp_set | alias datetime::settimestamp |
date_timezone_get | alias datetime::gettimezone |
date_timezone_set | alias datetime::settimezone |
date | format a local time/date |
getdate | obtain date/time information |
gettimeofday | get the current time |
gmdate | format a gmt/utc date/time |
gmmktime | get the unix timestamp of the gmt date |
gmstrftime | format gmt/utc time/date according to locale settings |
idate | format local time dates as integers |
localtime | get local time |
microtime | returns the current unix timestamp and microsecond count |
mktime | get a unix timestamp for a date |
strftime | format local time/date according to locale settings |
strptime | parses the date/time generated by strftime |
strtotime | parses the date-time description of any english text to a unix time stamp |
time | return the current unix timestamp |
timezone_abbreviations_list | alias datetimezone::listabbreviations |
timezone_identifiers_list | alias datetimezone::listidentifiers |
timezone_location_get | alias datetimezone::getlocation |
timezone_name_from_abbr | Returns the timezone name from abbreviation |
timezone_name_get | alias datetimezone::getname |
timezone_offset_get | alias datetimezone::getoffset |
timezone_open | alias datetimezone::__construct |
timezone_transitions_get | alias datetimezone::gettransitions |
timezone_version_get | Gets the version of the timezonedb |
PHP function reference table Introduction
about php programming introduction:1. php: an open source server-side scripting language, especially suitable for web development and can be used in html.
2. php is one of the earliest server-side scripting languages. since its establishment by rasmus lerdorf in 1995, php has become one of the widely used programming languages around the world.
3. php provides a large number of built-in functions, which cover all aspects from string processing to file system operations, database interaction, network communication, etc.
4. proficient in mastering the built-in functions in php, you can quickly get started with php programming, and save a lot of development time and costs.
Internet Business Promoter
Count of breaths
Helps you calculate how many breaths you have taken since birth
Prime number (prime number) online calculation generation
Calculate all primes within the specified range online
Angular unit conversion
Angle Unit Online conversion Tool
Online Cookie to JSON
Convert cookies to json format data online
CSS text shadow effect generation
Debug CSS text shadows online and generate CSS code
File directory tree generation
directory tree list of one-click generated file
CSS compression/formatting
CSS code online compression formatting tool
Compounding Calculator
Online Savings Interest Regenerated interest calculation tool
GIF image scale
Scale GIF images online for free
Treasury Yield Calculator
Online Treasury Yield Interest calculation tool
HSV/ hexadecimal Color conversion
HSV format and HEX format color value conversion
Online HEX with character conversion
online hexadecimal and text conversion tool
RGB/ hex conversion
RGB/HEX color conversion tool
Image watermark
Add watermark to image with one click
World Festival Inquiry
Provide solar calendar festival, Lunar festival, world festival online query
Key code comparison table
The key code of each key on the keyboard
Excel Shortcuts
Excel Shortcut tool is a tool that can help users quickly master and use all shortcuts in Excel software
National Language code comparison table
Online search for the corresponding code of each language
Abbreviation of Provinces and Capitals of China
Short name list of Chinese Provinces and their provincial capitals
Avatar Widget Generator
An online gadget that can generate Christmas avatar, holiday avatar, flag avatar
National Day Avatar Generator
Welcome National Day for a new face, hurry to get your National Day exclusive avatar!
Online name sorting tool
online name sorting tool, surname alphabetic sorting, surname stroke number sorting
Online text insertion tool
Batch insert the specified characters into the text online
UUID Generator
UUID online generator