This appendix describes the functions available in the built-in PHP extensions. These are the extensions that PHP is built with if you provide no --with
or --enable
options to configure
, and they cannot be removed via configuration options.
For each function, we’ve provided the function signature, showing the data types of the various arguments and which are mandatory or optional, as well as a brief description of the side effects, errors, and returned data structures.
This section gives a list of functions provided by PHP’s built-in extensions, grouped by extension category.
array_change_key_case
array_chunk
array_combine
array_count_values
array_diff
array_diff_assoc
array_diff_key
array_diff_uassoc
array_diff_ukey
array_fill
array_fill_keys
array_filter
array_flip
array_intersect
array_intersect_assoc
array_intersect_key
array_intersect_uassoc
array_intersect_ukey
array_key_exists
array_keys
array_map
array_merge
array_merge_recursive
array_multisort
array_pad
array_pop
array_product
array_push
array_rand
array_reduce
array_replace
array_replace_recursive
array_reverse
array_search
array_shift
array_slice
array_splice
array_sum
array_udiff
array_udiff_assoc
array_udiff_uassoc
array_uintersect
array_uintersect_assoc
array_uintersect_uassoc
array_unique
array_unshift
array_values
array_walk
array_walk_recursive
arsort
asort
compact
count
current
each
end
extract
in_array
is_countable
key
krsort
ksort
list
natcasesort
natsort
next
prev
range
reset
rsort
shuffle
sort
uasort
uksort
usort
class_alias
class_exists
get_called_class
get_class
get_class_methods
get_class_vars
get_declared_classes
get_declared_interfaces
get_declared_traits
get_object_vars
get_parent_class
interface_exists
is_a
is_subclass_of
method_exists
property_exists
trait_exists
filter_has_var
filter_id
filter_input_array
filter_var
filter_input
filter_list
filter_var_array
checkdate
date
date_default_timezone_get
date_default_timezone_set
date_parse
date_parse_from_format
date_sun_info
date_sunrise
date_sunset
getdate
gettimeofday
gmdate
gmmktime
gmstrftime
hrtime
idate
localtime
microtime
mktime
strftime
strptime
strtotime
time
timezone_name_from_abbr
timezone_version_get
chdir
chroot
closedir
dir
getcwd
opendir
readdir
rewinddir
scandir
debug_backtrace
debug_print_backtrace
error_clear_last
error_get_last
error_log
error_reporting
restore_error_handler
restore_exception_handler
set_error_handler
set_exception_handler
trigger_error
basename
chgrp
chmod
chown
clearstatcache
copy
dirname
disk_free_space
disk_total_space
fclose
feof
fflush
fgetc
fgetcsv
fgets
fgetss
file
file_exists
file_get_contents
file_put_contents
fileatime
filectime
filegroup
fileinode
filemtime
fileowner
fileperms
filesize
filetype
flock
fnmatch
fopen
fpassthru
fputcsv
fread
fscanf
fseek
fstat
ftell
ftruncate
fwrite
glob
is_dir
is_executable
is_file
is_link
is_readable
is_uploaded_file
is_writable
lchgrp
lchown
link
linkinfo
lstat
mkdir
move_uploaded_file
parse_ini_file
parse_ini_string
pathinfo
pclose
popen
readfile
readlink
realpath_cache_get
realpath_cache_size
realpath
rename
rewind
rmdir
stat
symlink
tempnam
tmpfile
touch
umask
unlink
call_user_func
call_user_func_array
create_function
forward_static_call
forward_static_call_array
func_get_arg
func_get_args
func_num_args
function_exists
get_defined_functions
register_shutdown_function
register_tick_function
unregister_tick_function
abs
acos
acosh
asin
asinh
atan2
atan
atanh
base_convert
bindec
ceil
cos
cosh
decbin
dechex
decoct
deg2rad
exp
expm1
floor
fmod
getrandmax
hexdec
hypot
is_finite
is_infinite
is_nan
lcg_value
log10
log1p
log
max
min
mt_getrandmax
mt_rand
mt_srand
octdec
pi
pow
rad2deg
rand
random_int
round
sin
sinh
sqrt
srand
tan
tanh
connection_aborted
connection_status
constant
define
defined
get_browser
highlight_file
highlight_string
ignore_user_abort
pack
php_strip_whitespace
sleep
sys_getloadavg
time_nanosleep
time_sleep_until
uniqid
unpack
usleep
checkdnsrr
closelog
fsockopen
gethostbyaddr
gethostbyname
gethostbynamel
gethostname
getmxrr
getprotobyname
getprotobynumber
getservbyname
getservbyport
header
header_remove
headers_list
headers_sent
inet_ntop
inet_pton
ip2long
long2ip
openlog
pfsockopen
setcookie
setrawcookie
syslog
flush
ob_clean
ob_end_clean
ob_end_flush
ob_flush
ob_get_clean
ob_get_contents
ob_get_flush
ob_get_length
ob_get_level
ob_get_status
ob_gzhandler
ob_implicit_flush
ob_list_handlers
ob_start
output_add_rewrite_var
output_reset_rewrite_vars
token_get_all
token_name
assert_options
assert
extension_loaded
gc_collect_cycles
gc_disable
gc_enable
gc_enabled
get_cfg_var
get_current_user
get_defined_constants
get_extension_funcs
get_include_path
get_included_files
get_loaded_extensions
getenv
getlastmod
getmygid
getmyinode
getmypid
getmyuid
getopt
getrusage
ini_get_all
ini_get
ini_restore
ini_set
memory_get_peak_usage
memory_get_usage
php_ini_loaded_file
php_ini_scanned_files
php_logo_guid
php_sapi_name
php_uname
phpcredits
phpinfo
phpversion
putenv
set_include_path
set_time_limit
sys_get_temp_dir
version_compare
zend_logo_guid
zend_thread_id
zend_version
escapeshellarg
escapeshellcmd
exec
passthru
proc_close
proc_get_status
proc_nice
proc_open
proc_terminate
shell_exec
system
session_cache_expire
session_cache_limiter
session_decode
session_destroy
session_encode
session_get_cookie_params
session_id
session_module_name
session_name
session_regenerate_id
session_register_shutdown
session_save_path
session_set_cookie_params
session_set_save_handler
session_start
session_status
session_unset
session_write_close
stream_bucket_append
stream_bucket_make_writeable
stream_bucket_new
stream_bucket_prepend
stream_context_create
stream_context_get_default
stream_context_get_options
stream_context_get_params
stream_context_set_default
stream_context_set_option
stream_context_set_params
stream_copy_to_stream
stream_encoding
stream_filter_append
stream_filter_prepend
stream_filter_register
stream_filter_remove
stream_get_contents
stream_get_filters
stream_get_line
stream_get_meta_data
stream_get_transports
stream_get_wrappers
stream_is_local
stream_notification_callback
stream_resolve_include_path
stream_select
stream_set_blocking
stream_set_chunk_size
stream_set_read_buffer
stream_set_timeout
stream_set_write_buffer
stream_socket_accept
stream_socket_client
stream_socket_enable_crypto
stream_socket_get_name
stream_socket_pair
stream_socket_recvfrom
stream_socket_sendto
stream_socket_server
stream_socket_shutdown
stream_supports_lock
stream_wrapper_register
stream_wrapper_restore
stream_wrapper_unregister
addcslashes
addslashes
bin2hex
chr
chunk_split
convert_cyr_string
convert_uudecode
convert_uuencode
count_chars
crc32
crypt
echo
explode
fprintf
get_html_translation_table
hebrev
hex2bin
html_entity_decode
htmlentities
htmlspecialchars
htmlspecialchars_decode
implode
lcfirst
levenshtein
localeconv
ltrim
md5
md5_file
metaphone
nl_langinfo
nl2br
number_format
ord
parse_str
printf
quoted_printable_decode
quoted_printable_encode
quotemeta
random_bytes
rtrim
setlocale
sha1
sha1_file
similar_text
soundex
sprintf
sscanf
str_getcsv
str_ireplace
str_pad
str_repeat
str_replace
str_rot13
str_shuffle
str_split
str_word_count
strcasecmp
strcmp
strcoll
strcspn
strip_tags
stripcslashes
stripos
stripslashes
stristr
strlen
strnatcasecmp
strnatcmp
strncasecmp
strncmp
strpbrk
strpos
strrchr
strrev
strripos
strrpos
strspn
strstr
strtok
strtolower
strtoupper
strtr
substr
substr_compare
substr_count
substr_replace
trim
ucfirst
ucwords
vfprintf
vprintf
vsprintf
wordwrap
base64_decode
base64_encode
get_headers
get_meta_tags
http_build_query
parse_url
rawurldecode
rawurlencode
urldecode
urlencode
debug_zval_dump
empty
floatval
get_defined_vars
get_resource_type
gettype
intval
is_array
is_bool
is_callable
is_float
is_int
is_null
is_numeric
is_object
is_resource
is_scalar
is_string
isset
print_r
serialize
settype
strval
unserialize
unset
var_dump
var_export
deflate_add
deflate_init
inflate_add
inflate_init
int abs(int
number) float abs(float
number)
Returns the absolute value of number in the same type (float or integer) as the argument.
float acos(float
value)
Returns the arc cosine of value in radians.
float acosh(float
value)
Returns the inverse hyberbolic cosine of value.
string addcslashes(string
string, string
characters)
Returns escaped instances of characters in string by adding a backslash before them. You can specify ranges of characters by separating them with two periods—for example, to escape characters between a
and q
, use "a..q"
. Multiple characters and ranges can be specified in characters. The addcslashes()
function is the inverse of stripcslashes()
.
string addslashes(string
string)
Returns escaped characters in string that have special meaning in SQL database queries. Single quotes (''
), double quotes (""
), backslashes (), and the NUL-byte (