Bài tập lập trình PHP cơ bản

PHP là gì?

  • PHP là viết tắt của Hypertext Preprocessor
  • Là ngôn ngữ lập trình mã nguồn mở, được sử dụng rộng rãi
  • Code PHP được thực thi trên server
  • PHP là ngôn ngữ lập trình có thể sử dụng và download hoàn toàn miễn phí

File PHP là gì?

  • File PHP có thể chứa text, HTML, CSS, JavaScript và code PHP
  • Code PHP được thực thi trên server và kết quả trả về trình duyệt dưới dạng HTML
  • File PHP có phần mở rộng là .php

PHP có thể giúp được gì?

  • PHP có thể tạo trang web động
  • PHP có thể tạo, mở file, đọc, ghi, xóa và đóng file ở server
  • PHP có thể tạo form thu thập dữ liệu
  • PHP có thể gửi và nhận cookie
  • PHP có thể thêm, xóa, sửa đổi dữ liệu trong cơ sở dữ liệu
  • PHP có thể được sử dụng để kiểm soát quyền truy cập của người dùng
  • PHP có thể mã hóa dữ liệu
  • Với PHP, bạn không có giới hạn HTML đầu ra. Bạn có thể xuất hình ảnh, tệp PDF và thậm chí cả phim Flash. Bạn cũng có thể xuất ra bất kỳ chuỗi văn bản gì, chẳng hạn như XHTML và XML.

Tại sao sử dụng ngôn ngữ lập trình PHP?

  • PHP chạy trên nhiều nền tảng khác nhau (Windows, Linux, Unix, Mac OS X, v.v.)
  • PHP tương thích với hầu hết các máy chủ được sử dụng ngày nay (Apache, IIS, v.v.)
  • PHP hỗ trợ nhiều loại cơ sở dữ liệu
  • PHP miễn phí và có thể tải xuống từ trang PHP chính thức: www.php.net
  • PHP đủ dễ dàng để trở thành ngôn ngữ phía máy chủ đầu tiên của người mới học lập trình web!
  • PHP đủ mạnh để trở thành cốt lõi của hệ thống viết blog lớn nhất trên web (WordPress, Joomla, Drupal,...)!
  • PHP đủ sâu để xây dựng những hệ thống mạng xã hội lớn

Array

array(): Creates an array
array_change_key_case(): Changes all keys in an array to lowercase or uppercase
array_chunk(): Splits an array into chunks of arrays
array_column(): Returns the values from a single column in the input array
array_combine(): Creates an array by using the elements from one "keys" array and one "values" array
array_count_values(): Counts all the values of an array
array_diff(): Compare arrays, and returns the differences (compare values only)
array_diff_assoc(): Compare arrays, and returns the differences (compare keys and values)
array_diff_key(): Compare arrays, and returns the differences (compare keys only)
array_diff_uassoc(): Compare arrays, and returns the differences (compare keys and values, using a user-defined key comparison function)
array_diff_ukey(): Compare arrays, and returns the differences (compare keys only, using a user-defined key comparison function)
array_fill(): Fills an array with values
array_fill_keys(): Fills an array with values, specifying keys
array_filter(): Filters the values of an array using a callback function
array_flip(): Flips/Exchanges all keys with their associated values in an array
array_intersect(): Compare arrays, and returns the matches (compare values only)
array_intersect_assoc(): Compare arrays and returns the matches (compare keys and values)
array_intersect_key(): Compare arrays, and returns the matches (compare keys only)
array_intersect_uassoc(): Compare arrays, and returns the matches (compare keys and values, using a user-defined key comparison function)
array_intersect_ukey(): Compare arrays, and returns the matches (compare keys only, using a user-defined key comparison function)
array_key_exists(): Checks if the specified key exists in the array
array_keys(): Returns all the keys of an array
array_map(): Sends each value of an array to a user-made function, which returns new values
array_merge(): Merges one or more arrays into one array
array_merge_recursive(): Merges one or more arrays into one array recursively
array_multisort(): Sorts multiple or multi-dimensional arrays
array_pad(): Inserts a specified number of items, with a specified value, to an array
array_pop(): Deletes the last element of an array
array_product(): Calculates the product of the values in an array
array_push(): Inserts one or more elements to the end of an array
array_rand(): Returns one or more random keys from an array
array_reduce(): Returns an array as a string, using a user-defined function
array_replace(): Replaces the values of the first array with the values from following arrays
array_replace_recursive(): Replaces the values of the first array with the values from following arrays recursively
array_reverse(): Returns an array in the reverse order
array_search(): Searches an array for a given value and returns the key
array_shift(): Removes the first element from an array, and returns the value of the removed element
array_slice(): Returns selected parts of an array
array_splice(): Removes and replaces specified elements of an array
array_sum(): Returns the sum of the values in an array
array_udiff(): Compare arrays, and returns the differences (compare values only, using a user-defined key comparison function)
array_udiff_assoc(): Compare arrays, and returns the differences (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values)
array_udiff_uassoc(): Compare arrays, and returns the differences (compare keys and values, using two user-defined key comparison functions)
array_uintersect(): Compare arrays, and returns the matches (compare values only, using a user-defined key comparison function)
array_uintersect_assoc(): Compare arrays, and returns the matches (compare keys and values, using a built-in function to compare the keys and a user-defined function to compare the values)
array_uintersect_uassoc(): Compare arrays, and returns the matches (compare keys and values, using two user-defined key comparison functions)
array_unique(): Removes duplicate values from an array
array_unshift(): Adds one or more elements to the beginning of an array
array_values(): Returns all the values of an array
array_walk(): Applies a user function to every member of an array
array_walk_recursive(): Applies a user function recursively to every member of an array
arsort(): Sorts an associative array in descending order, according to the value
asort(): Sorts an associative array in ascending order, according to the value
compact(): Create array containing variables and their values
count(): Returns the number of elements in an array
current(): Returns the current element in an array
each(): Deprecated from PHP 7.2. Returns the current key and value pair from an array
end(): Sets the internal pointer of an array to its last element
extract(): Imports variables into the current symbol table from an array
in_array(): Checks if a specified value exists in an array
key(): Fetches a key from an array
krsort(): Sorts an associative array in descending order, according to the key
ksort(): Sorts an associative array in ascending order, according to the key
list(): Assigns variables as if they were an array
natcasesort(): Sorts an array using a case insensitive "natural order" algorithm
natsort(): Sorts an array using a "natural order" algorithm
next(): Advance the internal array pointer of an array
pos(): Alias of current():
prev(): Rewinds the internal array pointer
range(): Creates an array containing a range of elements
reset(): Sets the internal pointer of an array to its first element
rsort(): Sorts an indexed array in descending order
shuffle(): Shuffles an array
sizeof(): Alias of count():
sort(): Sorts an indexed array in ascending order
uasort(): Sorts an array by values using a user-defined comparison function
uksort(): Sorts an array by keys using a user-defined comparison function
usort(): Sorts an array using a user-defined comparison function

Calendar

cal_days_in_month(): Returns the number of days in a month for a specified year and calendar
cal_from_jd(): Converts a Julian Day Count into a date of a specified calendar
cal_info(): Returns information about a specified calendar
cal_to_jd(): Converts a date in a specified calendar to Julian Day Count
easter_date(): Returns the Unix timestamp for midnight on Easter of a specified year
easter_days(): Returns the number of days after March 21, that the Easter Day is in a specified year
frenchtojd(): Converts a French Republican date to a Julian Day Count
gregoriantojd(): Converts a Gregorian date to a Julian Day Count
jddayofweek(): Returns the day of the week
jdmonthname(): Returns a month name
jdtofrench(): Converts a Julian Day Count to a French Republican date
jdtogregorian(): Converts a Julian Day Count to a Gregorian date
jdtojewish(): Converts a Julian Day Count to a Jewish date
jdtojulian(): Converts a Julian Day Count to a Julian date
jdtounix(): Converts Julian Day Count to Unix timestamp
jewishtojd(): Converts a Jewish date to a Julian Day Count
juliantojd(): Converts a Julian date to a Julian Day Count
unixtojd(): Converts Unix timestamp to Julian Day Count

Date

checkdate(): Validates a Gregorian date
date_add(): Adds days, months, years, hours, minutes, and seconds to a date
date_create_from_format(): Returns a new DateTime object formatted according to a specified format
date_create(): Returns a new DateTime object
date_date_set(): Sets a new date
date_default_timezone_get(): Returns the default timezone used by all date/time functions
date_default_timezone_set(): Sets the default timezone used by all date/time functions
date_diff(): Returns the difference between two dates
date_format(): Returns a date formatted according to a specified format
date_get_last_errors(): Returns the warnings/errors found in a date string
date_interval_create_from_date_string(): Sets up a DateInterval from the relative parts of the string
date_interval_format(): Formats the interval
date_isodate_set(): Sets the ISO date
date_modify(): Modifies the timestamp
date_offset_get(): Returns the timezone offset
date_parse_from_format(): Returns an associative array with detailed info about a specified date, according to a specified format
date_parse(): Returns an associative array with detailed info about a specified date
date_sub(): Subtracts days, months, years, hours, minutes, and seconds from a date
date_sun_info(): Returns an array containing info about sunset/sunrise and twilight begin/end, for a specified day and location
date_sunrise(): Returns the sunrise time for a specified day and location
date_sunset(): Returns the sunset time for a specified day and location
date_time_set(): Sets the time
date_timestamp_get(): Returns the Unix timestamp
date_timestamp_set(): Sets the date and time based on a Unix timestamp
date_timezone_get(): Returns the time zone of the given DateTime object
date_timezone_set(): Sets the time zone for the DateTime object
date(): Formats a local date and time
getdate(): Returns date/time information of a timestamp or the current local date/time
gettimeofday(): Returns the current time
gmdate(): Formats a GMT/UTC date and time
gmmktime(): Returns the Unix timestamp for a GMT date
gmstrftime(): Formats a GMT/UTC date and time according to locale settings
idate(): Formats a local time/date as integer
localtime(): Returns the local time
microtime(): Returns the current Unix timestamp with microseconds
mktime(): Returns the Unix timestamp for a date
strftime(): Formats a local time and/or date according to locale settings
strptime(): Parses a time/date generated with strftime(): 
strtotime(): Parses an English textual datetime into a Unix timestamp
time(): Returns the current time as a Unix timestamp
timezone_abbreviations_list(): Returns an associative array containing dst, offset, and the timezone name
timezone_identifiers_list(): Returns an indexed array with all timezone identifiers
timezone_location_get(): Returns location information for a specified timezone
timezone_name_from_ abbr(): Returns the timezone name from abbreviation
timezone_name_get(): Returns the name of the timezone
timezone_offset_get(): Returns the timezone offset from GMT
timezone_open(): Creates new DateTimeZone object
timezone_transitions_get(): Returns all transitions for the timezone
timezone_version_get(): Returns the version of the timezonedb

Directory

chdir(): Changes the current directory
chroot(): Changes the root directory
closedir(): Closes a directory handle
dir(): Returns an instance of the Directory class
getcwd(): Returns the current working directory
opendir(): Opens a directory handle
readdir(): Returns an entry from a directory handle
rewinddir(): Resets a directory handle
scandir(): Returns an array of files and directories of a specified directory

Error

debug_backtrace(): Generates a backtrace
debug_print_backtrace(): Prints a backtrace
error_clear_last(): Clears the last error
error_get_last(): Returns the last error that occurred
error_log(): Sends an error message to a log, to a file, or to a mail account
error_reporting(): Specifies which errors are reported
restore_error_handler(): Restores the previous error handler
restore_exception_handler(): Restores the previous exception handler
set_error_handler(): Sets a user-defined error handler function
set_exception_handler(): Sets a user-defined exception handler function
trigger_error(): Creates a user-level error message
user_error(): Alias of trigger_error()

Exception

Exception(): The constructor of the Exception object
getCode(): Returns the exception code
getFile(): Returns the full path of the file in which the exception was thrown
getMessage(): Returns a string describing why the exception was thrown
getLine(): Returns the line number of the line of code which threw the exception
getPrevious(): If this exception was triggered by another one, this method returns the previous exception. If not, then it returns null
getTrace(): Returns an array with information about all of the functions that were running at the time the exception was thrown
getTraceAsString(): Returns the same information as getTrace():, but in a string

Filesystem

basename(): Returns the filename component of a path
chgrp(): Changes the file group
chmod(): Changes the file mode
chown(): Changes the file owner
clearstatcache(): Clears the file status cache
copy(): Copies a file
delete(): See unlink():
dirname(): Returns the directory name component of a path
disk_free_space(): Returns the free space of a filesystem or disk
disk_total_space(): Returns the total size of a filesystem or disk
diskfreespace(): Alias of disk_free_space():
fclose(): Closes an open file
feof(): Checks if the "end-of-file" (EOF) has been reached for an open file
fflush(): Flushes buffered output to an open file
fgetc(): Returns a single character from an open file
fgetcsv(): Returns a line from an open CSV file
fgets(): Returns a line from an open file
fgetss(): Deprecated from PHP 7.3. Returns a line from an open file - stripped from HTML and PHP tags
file(): Reads a file into an array
file_exists(): Checks whether or not a file or directory exists
file_get_contents(): Reads a file into a string
file_put_contents(): Writes data to a file
fileatime(): Returns the last access time of a file
filectime(): Returns the last change time of a file
filegroup(): Returns the group ID of a file
fileinode(): Returns the inode number of a file
filemtime(): Returns the last modification time of a file
fileowner(): Returns the user ID (owner) of a file
fileperms(): Returns the file's permissions
filesize(): Returns the file size
filetype(): Returns the file type
flock(): Locks or releases a file
fnmatch(): Matches a filename or string against a specified pattern
fopen(): Opens a file or URL
fpassthru(): Reads from the current position in a file - until EOF, and writes the result to the output buffer
fputcsv(): Formats a line as CSV and writes it to an open file
fputs(): Alias of fwrite():
fread(): Reads from an open file (binary-safe)
fscanf(): Parses input from an open file according to a specified format
fseek(): Seeks in an open file
fstat(): Returns information about an open file
ftell(): Returns the current position in an open file
ftruncate(): Truncates an open file to a specified length
fwrite(): Writes to an open file (binary-safe)
glob(): Returns an array of filenames / directories matching a specified pattern
is_dir(): Checks whether a file is a directory
is_executable(): Checks whether a file is executable
is_file(): Checks whether a file is a regular file
is_link(): Checks whether a file is a link
is_readable(): Checks whether a file is readable
is_uploaded_file(): Checks whether a file was uploaded via HTTP POST
is_writable(): Checks whether a file is writable
is_writeable(): Alias of is_writable():
lchgrp(): Changes the group ownership of a symbolic link
lchown(): Changes the user ownership of a symbolic link
link(): Creates a hard link
linkinfo(): Returns information about a hard link
lstat(): Returns information about a file or symbolic link
mkdir(): Creates a directory
move_uploaded_file(): Moves an uploaded file to a new location
parse_ini_file(): Parses a configuration file
parse_ini_string(): Parses a configuration string
pathinfo(): Returns information about a file path
pclose(): Closes a pipe opened by popen():
popen(): Opens a pipe
readfile(): Reads a file and writes it to the output buffer
readlink(): Returns the target of a symbolic link
realpath(): Returns the absolute pathname
realpath_cache_get(): Returns realpath cache entries
realpath_cache_size(): Returns realpath cache size
rename(): Renames a file or directory
rewind(): Rewinds a file pointer
rmdir(): Removes an empty directory
set_file_buffer(): Alias of stream_set_write_buffer():. Sets the buffer size for write operations on the given file
stat(): Returns information about a file
symlink(): Creates a symbolic link
tempnam(): Creates a unique temporary file
tmpfile(): Creates a unique temporary file
touch(): Sets access and modification time of a file
umask(): Changes file permissions for files
unlink(): Deletes a file

Filter 

filter_has_var(): Checks whether a variable of a specified input type exist
filter_id(): Returns the filter ID of a specified filter name
filter_input(): Gets an external variable (e.g. from form input) and optionally filters it
filter_input_array(): Gets external variables (e.g. from form input) and optionally filters them
filter_list(): Returns a list of all supported filter names
filter_var(): Filters a variable with a specified filter
filter_var_array(): Gets multiple variables and filter them

FTP 

ftp_alloc(): Allocates space for a file to be uploaded to the FTP server
ftp_cdup(): Changes to the parent directory on the FTP server
ftp_chdir(): Changes the current directory on the FTP server
ftp_chmod(): Sets permissions on a file via FTP
ftp_close(): Closes an FTP connection
ftp_connect(): Opens an FTP connection
ftp_delete(): Deletes a file on the FTP server
ftp_exec(): Executes a command on the FTP server
ftp_fget(): Downloads a file from the FTP server and saves it into an open local file
ftp_fput(): Uploads from an open file and saves it to a file on the FTP server
ftp_get(): Downloads a file from the FTP server
ftp_get_option(): Returns runtime options of the FTP connection
ftp_login(): Logs in to the FTP connection
ftp_mdtm(): Returns the last modified time of a specified file
ftp_mkdir(): Creates a new directory on the FTP server
ftp_mlsd(): Returns the list of files in the specified directory
ftp_nb_continue(): Continues retrieving/sending a file (non-blocking)
ftp_nb_fget(): Downloads a file from the FTP server and saves it into an open file (non-blocking)
ftp_nb_fput(): Uploads from an open file and saves it to a file on the FTP server (non-blocking)
ftp_nb_get(): Downloads a file from the FTP server (non-blocking)
ftp_nb_put(): Uploads a file to the FTP server (non-blocking)
ftp_nlist(): Returns a list of files in the specified directory on the FTP server
ftp_pasv(): Turns passive mode on or off
ftp_put(): Uploads a file to the FTP server
ftp_pwd(): Returns the current directory name
ftp_quit(): Alias of ftp_close():
ftp_raw(): Sends a raw command to the FTP server
ftp_rawlist(): Returns a list of files with file information from a specified directory
ftp_rename(): Renames a file or directory on the FTP server
ftp_rmdir(): Deletes an empty directory on the FTP server
ftp_set_option(): Sets runtime options for the FTP connection
ftp_site(): Sends an FTP SITE command to the FTP server
ftp_size(): Returns the size of the specified file
ftp_ssl_connect(): Opens a secure SSL-FTP connection
ftp_systype(): Returns the system type identifier of the FTP server

JSON 

json_decode(): Decodes a JSON string
json_encode(): Encode a value to JSON format
json_last_error(): Returns the last error occurred
json_last_error_msg(): Returns the error string of the last json_encode() or json_decode() call

Libxml 

libxml_clear_errors():  Clears the libxml error buffer
libxml_disable_entity_loader():  Enables the ability to load external entities
libxml_get_errors():  Gets the errors from the the libxml error buffer
libxml_get_last_error():  Gets the last error from the the libxml error buffer
libxml_set_external_entity_loader():  Changes the default external entity loader
libxml_set_streams_context():  Sets the streams context for the next libxml document load or write
libxml_use_internal_errors():  Disables the standard libxml errors and enables user error handling

Mail 

ezmlm_hash(): Calculates the hash value needed by EZMLM
mail(): Allows you to send emails directly from a script

Math 

abs(): Returns the absolute (positive) value of a number
acos(): Returns the arc cosine of a number
acosh(): Returns the inverse hyperbolic cosine of a number
asin(): Returns the arc sine of a number
asinh(): Returns the inverse hyperbolic sine of a number
atan(): Returns the arc tangent of a number in radians
atan2(): Returns the arc tangent of two variables x and y
atanh(): Returns the inverse hyperbolic tangent of a number
base_convert(): Converts a number from one number base to another
bindec(): Converts a binary number to a decimal number
ceil(): Rounds a number up to the nearest integer
cos(): Returns the cosine of a number
cosh(): Returns the hyperbolic cosine of a number
decbin(): Converts a decimal number to a binary number
dechex(): Converts a decimal number to a hexadecimal number
decoct(): Converts a decimal number to an octal number
deg2rad(): Converts a degree value to a radian value
exp(): Calculates the exponent of e
expm1(): Returns exp(x) - 1
floor(): Rounds a number down to the nearest integer
fmod(): Returns the remainder of x/y
getrandmax(): Returns the largest possible value returned by rand()
hexdec(): Converts a hexadecimal number to a decimal number
hypot(): Calculates the hypotenuse of a right-angle triangle
intdiv(): Performs integer division
is_finite(): Checks whether a value is finite or not
is_infinite(): Checks whether a value is infinite or not
is_nan(): Checks whether a value is 'not-a-number'
lcg_value(): Returns a pseudo random number in a range between 0 and 1
log(): Returns the natural logarithm of a number
log10(): Returns the base-10 logarithm of a number
log1p(): Returns log(1+number)
max(): Returns the highest value in an array, or the highest value of several specified values
min(): Returns the lowest value in an array, or the lowest value of several specified values
mt_getrandmax(): Returns the largest possible value returned by mt_rand()
mt_rand(): Generates a random integer using Mersenne Twister algorithm
mt_srand(): Seeds the Mersenne Twister random number generator
octdec(): Converts an octal number to a decimal number
pi(): Returns the value of PI
pow(): Returns x raised to the power of y
rad2deg(): Converts a radian value to a degree value
rand(): Generates a random integer
round(): Rounds a floating-point number
sin(): Returns the sine of a number
sinh(): Returns the hyperbolic sine of a number
sqrt(): Returns the square root of a number
srand(): Seeds the random number generator
tan(): Returns the tangent of a number
tanh(): Returns the hyperbolic tangent of a number

Misc 

connection_aborted():  Checks whether the client has disconnected
connection_status():  Returns the current connection status
connection_timeout():  Deprecated from PHP 4.0.5. Checks whether the script has timed out
constant():  Returns the value of a constant
define():  Defines a constant
defined():  Checks whether a constant exists
die():  Alias of exit(): 
eval():  Evaluates a string as PHP code
exit():  Prints a message and exits the current script
get_browser():  Returns the capabilities of the user's browser
__halt_compiler():  Halts the compiler execution
highlight_file():  Outputs a file with the PHP syntax highlighted
highlight_string():  Outputs a string with the PHP syntax highlighted
hrtime():  Returns the system's high resolution time
ignore_user_abort():  Sets whether a remote client can abort the running of a script
pack():  Packs data into a binary string
php_strip_whitespace():  Returns the source code of a file with PHP comments and whitespace removed
show_source():  Alias of highlight_file(): 
sleep():  Delays code execution for a number of seconds
sys_getloadavg():  Returns the system load average
time_nanosleep():  Delays code execution for a number of seconds and nanoseconds
time_sleep_until():  Makes a script sleep until the specified time
uniqid():  Generates a unique ID
unpack():  Unpacks data from a binary string
usleep():  Delays code execution for a number of microseconds

MySQLi 

affected_rows(): Returns the number of affected rows in the previous MySQL operation
autocommit(): Turns on or off auto-committing database modifications
begin_transaction(): Starts a transaction
change_user(): Changes the user of the specified database connection
character_set_name(): Returns the default character set for the database connection
close(): Closes a previously opened database connection
commit(): Commits the current transaction
connect(): Opens a new connection to the MySQL server
connect_errno(): Returns the error code from the last connection error
connect_error(): Returns the error description from the last connection error
data_seek(): Adjusts the result pointer to an arbitrary row in the result-set
debug(): Performs debugging operations
dump_debug_info(): Dumps debugging info into the log
errno(): Returns the last error code for the most recent function call
error(): Returns the last error description for the most recent function call
error_list(): Returns a list of errors for the most recent function call
fetch_all(): Fetches all result rows as an associative array, a numeric array, or both
fetch_array(): Fetches a result row as an associative, a numeric array, or both
fetch_assoc(): Fetches a result row as an associative array
fetch_field(): Returns the next field in the result-set, as an object
fetch_field_direct(): Returns meta-data for a single field in the result-set, as an object
fetch_fields(): Returns an array of objects that represent the fields in a result-set
fetch_lengths(): Returns the lengths of the columns of the current row in the result-set
fetch_object(): Returns the current row of a result-set, as an object
fetch_row(): Fetches one row from a result-set and returns it as an enumerated array
field_count(): Returns the number of columns for the most recent query
field_seek(): Sets the field cursor to the given field offset
get_charset(): Returns a character set object
get_client_info(): Returns the MySQL client library version
get_client_stats(): Returns statistics about client per-process
get_client_version(): Returns the MySQL client library version as an integer
get_connection_stats(): Returns statistics about the client connection
get_host_info(): Returns the MySQL server hostname and the connection type
get_proto_info(): Returns the MySQL protocol version
get_server_info(): Returns the MySQL server version
get_server_version(): Returns the MySQL server version as an integer
info(): Returns information about the last executed query
init(): Initializes MySQLi and returns a resource for use with real_connect()
insert_id(): Returns the auto-generated id from the last query
kill(): Asks the server to kill a MySQL thread
more_results(): Checks if there are more results from a multi query
multi_query(): Performs one or more queries on the database
next_result(): Prepares the next result-set from multi_query()
options(): Sets extra connect options and affect behavior for a connection
ping(): Pings a server connection, or tries to reconnect if the connection has gone down
poll(): Polls connections
prepare(): Prepares an SQL statement for execution
query(): Performs a query against a database
real_connect(): Opens a new connection to the MySQL server
real_escape_string(): Escapes special characters in a string for use in an SQL statement
real_query(): Executes a single SQL query
reap_async_query(): Returns result from an async SQL query
refresh(): Refreshes/flushes tables or caches, or resets the replication server information
rollback(): Rolls back the current transaction for the database
select_db(): Select the default database for database queries
set_charset(): Sets the default client character set
set_local_infile_default(): Unsets user defined handler for load local infile command
set_local_infile_handler(): Set callback function for LOAD DATA LOCAL INFILE command
sqlstate(): Returns the SQLSTATE error code for the error
ssl_set(): Used to establish secure connections using SSL
stat(): Returns the current system status
stmt_init(): Initializes a statement and returns an object for use with stmt_prepare()
store_result(): Transfers a result-set from the last query
thread_id(): Returns the thread ID for the current connection
thread_safe(): Returns whether the client library is compiled as thread-safe
use_result(): Initiates the retrieval of a result-set from the last query executed
warning_count(): Returns the number of warnings from the last query in the connection

Network 

checkdnsrr(): Checks DNS records for type corresponding to host
closelog(): Closes the connection of system logger
define_syslog_variables(): Deprecated and removed in PHP 5.4. Initializes the variables used in syslog functions
dns_check_record(): Alias of checkdnsrr()
dns_get_mx(): Alias of getmxrr()
dns_get_record(): Gets the DNS resource records associated with the specified hostname
fsockopen(): Opens an Internet or Unix domain socket connection
gethostbyaddr(): Returns the domain name for a given IP address
gethostbyname(): Returns the IPv4 address for a given domain/host name
gethostbynamel(): Returns a list of IPv4 address for a given domain/host name
gethostname(): Returns the host name
getmxrr(): Returns the MX records for the specified internet host name
getprotobyname(): Returns the protocol number for a given protocol name
getprotobynumber(): Returns the protocol name for a given protocol number
getservbyname(): Returns the port number for a given Internet service and protocol
getservbyport(): Returns the Internet service for a given port and protocol
header_register_callback(): Calls a header function
header_remove(): Removes an HTTP header previously set with the header() function
header(): Sends a raw HTTP header to a client
headers_list(): Returns a list of response headers to be sent to the browser
headers_sent(): Checks if/where headers have been sent
http_response_code(): Sets or returns the HTTP response status code
inet_ntop(): Converts a 32bit IPv4 or 128bit IPv6 address into a readable format
inet_pton(): Converts a readable IP address into a packed 32bit IPv4 or 128bit IPv6 format
ip2long(): Converts an IPv4 address into a long integer
long2ip(): Converts a long integer address into a string in IPv4 format
openlog(): Opens the connection of system logger
pfsockopen(): Opens a persistent Internet or Unix domain socket connection
setcookie(): Defines a cookie to be sent along with the rest of the HTTP headers
setrawcookie(): Defines a cookie (without URL encoding) to be sent along with the rest of the HTTP headers
socket_get_status(): Alias of stream_get_meta_data()
socket_set_blocking(): Alias of stream_set_blocking()
socket_set_timeout(): Alias of stream_set_timeout()
syslog(): Generates a system log message

Output 

flush(): Attempts to send content from the system's output buffer to the browser
ob_clean(): Deletes all of the content from the topmost output buffer
ob_end_clean(): Deletes the topmost output buffer and all of its contents
ob_end_flush(): Deletes the topmost output buffer and outputs its contents
ob_flush(): Outputs the contents of the topmost output buffer and clears the buffer
ob_get_clean(): Returns all of the contents of the topmost output buffer and clears the buffer
ob_get_contents(): Returns the contents of the topmost output buffer
ob_get_flush(): Outputs and returns the contents of the topmost output buffer and then deletes the buffer
ob_get_length(): Returns the number of bytes of data that are in the topmost output buffer
ob_get_level(): Returns a number indicating how many output buffers are on the stack
ob_get_status(): Returns information about the output buffers
ob_gzhandler(): Used as a callback function for ob_start(): to compress the contents of the buffer when sending it to the browser
ob_implicit_flush(): Turns implicit flushing on or off
ob_list_handlers(): Returns an array of callback function names that are being used by the topmost output buffer
ob_start(): Creates a new output buffer and adds it to the top of the stack
output_add_rewrite_var(): Used to append query string parameters to any URL in the output
output_reset_rewrite_vars(): Removes all variables added by output_add_rewrite_var()

RegEx 

preg_filter(): Returns a string or an array with pattern matches replaced, but only if matches were found
preg_grep(): Returns an array consisting only of elements from the input array which matched the pattern
preg_last_error(): Returns an error code indicating the reason that the most recent regular expression call failed
preg_match(): Finds the first match of a pattern in a string
preg_match_all(): Finds all matches of a pattern in a string
preg_replace(): Returns a string where matches of a pattern (or an array of patterns) are replaced with a substring (or an array of substrings) in a given string
preg_replace_callback(): Given an expression and a callback, returns a string where all matches of the expression are replaced with the substring returned by the callback
preg_replace_callback_array(): Given an array associating expressions with callbacks, returns a string where all matches of each expression are replaced with the substring returned by the callback
preg_split(): Breaks a string into an array using matches of a regular expression as separators
preg_quote(): Escapes characters that have a special meaning in regular expressions by putting a backslash in front of them

SimpleXML 

__construct(): Creates a new SimpleXMLElement object
__toString(): Returns the string content of an element
addAttribute(): Appends an attribute to the SimpleXML element
addChild(): Appends a child element the SimpleXML element
asXML(): Returns a well-formed XML string (XML version 1.0) from a SimpleXML object
attributes(): Returns the attributes/values of an element
children(): Returns the children of a specified node
count(): Counts the children of a specified node
getDocNamespaces(): Returns the namespaces declared in document
getName(): Returns the name of an element
getNamespaces(): Returns the namespaces used in document
registerXPathNamespace(): Creates a namespace context for the next XPath query
saveXML(): Alias of asXML():
simplexml_import_dom(): Returns a SimpleXMLElement object from a DOM node
simplexml_load_file(): Converts an XML document to an object
simplexml_load_string(): Converts an XML string to an object
xpath(): Runs an XPath query on XML data
current(): Returns the current element
getChildren(): Returns the child elements of the current element
hasChildren(): Checks whether the current element has children
key(): Returns the XML tag name of the current element
next(): Moves to the next element
rewind(): Rewinds to the first element
valid(): Checks whether the current element is valid

Stream 

stream_copy_to_stream(): Copies data from one stream to another
stream_filter_append(): Appends a filter to a stream
stream_register_wrapper(): Alias of stream_wrapper_register()

String 

addcslashes(): Returns a string with backslashes in front of the specified characters
addslashes(): Returns a string with backslashes in front of predefined characters
bin2hex(): Converts a string of ASCII characters to hexadecimal values
chop(): Removes whitespace or other characters from the right end of a string
chr(): Returns a character from a specified ASCII value
chunk_split(): Splits a string into a series of smaller parts
convert_cyr_string(): Converts a string from one Cyrillic character-set to another
convert_uudecode(): Decodes a uuencoded string
convert_uuencode(): Encodes a string using the uuencode algorithm
count_chars(): Returns information about characters used in a string
crc32(): Calculates a 32-bit CRC for a string
crypt(): One-way string hashing
echo(): Outputs one or more strings
explode(): Breaks a string into an array
fprintf(): Writes a formatted string to a specified output stream
get_html_translation_table(): Returns the translation table used by htmlspecialchars() and htmlentities()
hebrev(): Converts Hebrew text to visual text
hebrevc(): Converts Hebrew text to visual text and new lines (\n) into <br>
hex2bin(): Converts a string of hexadecimal values to ASCII characters
html_entity_decode(): Converts HTML entities to characters
htmlentities(): Converts characters to HTML entities
htmlspecialchars_decode(): Converts some predefined HTML entities to characters
htmlspecialchars(): Converts some predefined characters to HTML entities
implode(): Returns a string from the elements of an array
join(): Alias of implode():
lcfirst(): Converts the first character of a string to lowercase
levenshtein(): Returns the Levenshtein distance between two strings
localeconv(): Returns locale numeric and monetary formatting information
ltrim(): Removes whitespace or other characters from the left side of a string
md5(): Calculates the MD5 hash of a string
md5_file(): Calculates the MD5 hash of a file
metaphone(): Calculates the metaphone key of a string
money_format(): Returns a string formatted as a currency string
nl_langinfo(): Returns specific local information
nl2br(): Inserts HTML line breaks in front of each newline in a string
number_format(): Formats a number with grouped thousands
ord(): Returns the ASCII value of the first character of a string
parse_str(): Parses a query string into variables
print(): Outputs one or more strings
printf(): Outputs a formatted string
quoted_printable_decode(): Converts a quoted-printable string to an 8-bit string
quoted_printable_encode(): Converts an 8-bit string to a quoted printable string
quotemeta(): Quotes meta characters
rtrim(): Removes whitespace or other characters from the right side of a string
setlocale(): Sets locale information
sha1(): Calculates the SHA-1 hash of a string
sha1_file(): Calculates the SHA-1 hash of a file
similar_text(): Calculates the similarity between two strings
soundex(): Calculates the soundex key of a string
sprintf(): Writes a formatted string to a variable
sscanf(): Parses input from a string according to a format
str_getcsv(): Parses a CSV string into an array
str_ireplace(): Replaces some characters in a string (case-insensitive)
str_pad(): Pads a string to a new length
str_repeat(): Repeats a string a specified number of times
str_replace(): Replaces some characters in a string (case-sensitive)
str_rot13(): Performs the ROT13 encoding on a string
str_shuffle(): Randomly shuffles all characters in a string
str_split(): Splits a string into an array
str_word_count(): Count the number of words in a string
strcasecmp(): Compares two strings (case-insensitive)
strchr(): Finds the first occurrence of a string inside another string (alias of strstr():)
strcmp(): Compares two strings (case-sensitive)
strcoll(): Compares two strings (locale based string comparison)
strcspn(): Returns the number of characters found in a string before any part of some specified characters are found
strip_tags(): Strips HTML and PHP tags from a string
stripcslashes(): Unquotes a string quoted with addcslashes()
stripslashes(): Unquotes a string quoted with addslashes()
stripos(): Returns the position of the first occurrence of a string inside another string (case-insensitive)
stristr(): Finds the first occurrence of a string inside another string (case-insensitive)
strlen(): Returns the length of a string
strnatcasecmp(): Compares two strings using a "natural order" algorithm (case-insensitive)
strnatcmp(): Compares two strings using a "natural order" algorithm (case-sensitive)
strncasecmp(): String comparison of the first n characters (case-insensitive)
strncmp(): String comparison of the first n characters (case-sensitive)
strpbrk(): Searches a string for any of a set of characters
strpos(): Returns the position of the first occurrence of a string inside another string (case-sensitive)
strrchr(): Finds the last occurrence of a string inside another string
strrev(): Reverses a string
strripos(): Finds the position of the last occurrence of a string inside another string (case-insensitive)
strrpos(): Finds the position of the last occurrence of a string inside another string (case-sensitive)
strspn(): Returns the number of characters found in a string that contains only characters from a specified charlist
strstr(): Finds the first occurrence of a string inside another string (case-sensitive)
strtok(): Splits a string into smaller strings
strtolower(): Converts a string to lowercase letters
strtoupper(): Converts a string to uppercase letters
strtr(): Translates certain characters in a string
substr(): Returns a part of a string
substr_compare(): Compares two strings from a specified start position (binary safe and optionally case-sensitive)
substr_count(): Counts the number of times a substring occurs in a string
substr_replace(): Replaces a part of a string with another string
trim(): Removes whitespace or other characters from both sides of a string
ucfirst(): Converts the first character of a string to uppercase
ucwords(): Converts the first character of each word in a string to uppercase
vfprintf(): Writes a formatted string to a specified output stream
vprintf(): Outputs a formatted string
vsprintf(): Writes a formatted string to a variable
wordwrap(): Wraps a string to a given number of characters

Var Handling 

boolval(): Returns 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(): Checks whether a variable is empty
floatval(): Returns the float value of a variable
get_defined_vars(): Returns all defined variables, as an array
get_resource_type(): Returns the type of a resource
gettype(): Returns the type of a variable
intval(): Returns the integer value of a variable
is_array(): Checks whether a variable is an array
is_bool(): Checks whether a variable is a boolean
is_callable(): Checks whether the contents of a variable can be called as a function
is_countable(): Checks whether the contents of a variable is a countable value
is_double(): Alias of is_float()
is_float(): Checks whether a variable is of type float
is_int(): Checks whether a variable is of type integer
is_integer(): Alias of is_int()
is_iterable(): Checks whether the contents of a variable is an iterable value
is_long(): Alias of is_int()
is_null(): Checks whether a variable is NULL
is_numeric(): Checks whether a variable is a number or a numeric string
is_object(): Checks whether a variable is an object
is_real(): Alias of is_float()
is_resource(): Checks whether a variable is a resource
is_scalar(): Checks whether a variable is a scalar
is_string(): Checks whether a variable is of type string
isset(): Checks whether a variable is set (declared and not NULL)
print_r(): Prints the information about a variable in a human-readable way
serialize(): Converts a storable representation of a value
settype(): Converts a variable to a specific type
strval(): Returns the string value of a variable
unserialize(): Converts serialized data back into actual data
unset(): Unsets a variable
var_dump(): Dumps information about one or more variables
var_export(): Returns structured information (valid PHP code) about a variable

XML Parser 

utf8_decode(): Decodes an UTF-8 string to ISO-8859-1
utf8_encode(): Encodes an ISO-8859-1 string to UTF-8
xml_error_string(): Returns an error string from the XML parser
xml_get_current_byte_index(): Returns the current byte index from the XML parser
xml_get_current_column_number(): Returns the current column number from the XML parser
xml_get_current_line_number(): Returns the current line number from the XML parser
xml_get_error_code(): Returns an error code from the XML parser
xml_parse(): Parses an XML document
xml_parse_into_struct(): Parses XML data into an array
xml_parser_create_ns(): Creates an XML parser with namespace support
xml_parser_create(): Creates an XML parser
xml_parser_free(): Frees an XML parser
xml_parser_get_option(): Returns options from an XML parser
xml_parser_set_option(): Sets options in an XML parser
xml_set_character_data_handler(): Sets up the character data handler for the XML parser
xml_set_default_handler(): Sets up the default data handler for the XML parser
xml_set_element_handler(): Sets up start and end element handlers for the XML parser
xml_set_end_namespace_decl_handler(): Sets up the end namespace declaration handler
xml_set_external_entity_ref_handler(): Sets up the external entity reference handler for the XML parser
xml_set_notation_decl_handler(): Sets up notation declaration handler for the XML parser
xml_set_object(): Allows to use XML parser within an object
xml_set_processing_instruction_handler(): Sets up processing instruction handler
xml_set_start_namespace_decl_handler(): Sets up the start namespace declaration handler
xml_set_unparsed_entity_decl_handler(): Sets handler function for unparsed entity declarations

Zip 

zip_close(): Closes a ZIP file archive
zip_entry_close(): Closes a ZIP directory entry
zip_entry_compressedsize(): Returns the compressed file size of a ZIP directory entry
zip_entry_compressionmethod(): Returns the compression method of a ZIP directory entry
zip_entry_filesize(): Returns the actual file size of a ZIP directory entry
zip_entry_name(): Returns the name of a ZIP directory entry
zip_entry_open(): Opens a directory entry in a ZIP file for reading
zip_entry_read(): Reads from an open directory entry in the ZIP file
zip_open(): Opens a ZIP file archive
zip_read(): Reads the next file in a open ZIP file archive

Timezones