PHP Common functions (2)

Source: Internet
Author: User
Tags ftp connection http cookie julian day php error remote ftp server republican calendar sorts sunrise time
In the daily development, most novice is very puzzled, so many PHP built-in function how to remember, in fact, you just know that there is this thing is OK, use more time you naturally remember, the following collection of PHP development when the most commonly used functions, I hope to help you.


The ACOs () function returns the inverse cosine of a number.
The ABS () function returns the absolute value of a number.
The mail () function allows you to send e-mail directly from a script.
The Libxml_use_internal_errors () function disables standard libxml errors and enables user error handling.
The Libxml_get_last_error () function gets the last error from the libxml error buffer.
The Libxml_get_errors () function gets an error from the libxml error buffer.
The Libxml_clear_errors () function empties the libxml error buffer.
The Setrawcookie () function does not URL-encode the cookie value and sends an HTTP cookie.
The Setcookie () function sends an HTTP cookie to the client.
The Headers_sent () function checks to see if the HTTP header is sent/sent to.
The Headers_list () function returns a list of sent (or pending) response headers.
The header () function sends the original HTTP header to the client.
The Ftp_systype () function returns the system type identifier of the remote FTP server.
The Ftp_ssl_connect () function opens a secure ssl-ftp connection.
The Ftp_size () function returns the size of the specified file.
The Ftp_site () function sends the site command to the server.
The Ftp_set_option () function sets various FTP run-time options.
The Ftp_rmdir () function deletes a directory.
The Ftp_rename () function changes the file or directory name on the FTP server.
The Ftp_rawlist () function returns a detailed list of the files in the specified directory.
The Ftp_raw () function sends a raw command to the FTP server.
The Ftp_quit () function closes the FTP connection.
The FTP_PWD () function returns the current directory name.
The Ftp_put () function uploads the file to the server.
The FTP_PASV () function sets the passive mode to on or off.
The Ftp_nlist () function returns a list of files for the specified directory.
The Ftp_nb_put () function uploads the file to the server (non-blocking).
The Ftp_nb_get () function obtains the file from the FTP server and writes to the local file (non-blocking).
The Ftp_nb_fput () function uploads an open file and saves it as a file (non-blocking) on the FTP server.
The Ftp_nb_fget () function downloads a file from the FTP server and saves it to a file that is already open locally (non-blocking).
The Ftp_nb_continue () function gets/sends the file continuously.
The Ftp_mkdir () function creates a new directory on the FTP server.
The Ftp_mdtm () function returns the last modified time of the specified file.
The Ftp_login () function logs on to the FTP server.
The Ftp_get () function downloads a file from the FTP server.
The Ftp_get_option () function returns the various options settings for the current FTP connection.
The Ftp_fput () function uploads an already opened file to the FTP server.
The Ftp_fget () function downloads a file from the FTP server and saves it to a local file that is already open.
The Ftp_exec () function requests that a program or command be executed on the FTP server.
The Ftp_delete () function deletes a file on the FTP server.
The Ftp_connect () function establishes a new FTP connection.
The Ftp_close () function closes the FTP connection.
The Ftp_chmod () function sets permissions on the specified file on the FTP server.
The Ftp_chdir () function changes the current directory on the FTP server.
The Ftp_cdup () function changes the current directory to the parent directory on the FTP server.
The Ftp_alloc () function allocates space for files to be uploaded to the FTP server.
The Filter_var () function filters variables by the specified filter.
The Filter_var_array () function gets the multiple variables and filters them.
The Filter_list () function returns an array that contains all the supported filters.
The Filter_input_array () function obtains multiple inputs from outside the script and filters them.
The Filter_input () function takes input from outside the script and filters it.
The filter_id () function returns the ID number of the specified filter.
The Filter_has_var () function checks for the existence of a variable of the specified input type.
The unlink () function deletes the file.
The Umask () function changes the current umask.
The touch () function sets the access and modification times for the specified file.
The Tmpfile () function establishes a temporary file with a unique file name in read-write (w+) mode.
The Tempnam () function creates a temporary file with a unique file name.
The Symlink () function creates a symbolic connection.
The stat () function returns information about the file.
The Set_file_buffer () function sets the buffer size of the open file.
The RmDir () function removes the empty directory.
The rewind () function returns the position of the file pointer back to the beginning of the file.
The rename () function renames the file or directory.
The Realpath () function returns an absolute path.
The Readlink () function returns the target to which the symbolic connection is directed.
The ReadFile () function outputs a file.
The Popen () function opens the process file pointer.
The Pclose () function closes the pipe opened by Popen ().
The PathInfo () function returns information about the file path in the form of an array.
The Parse_ini_file () function parses a configuration file and returns the settings in the form of an array.
The Move_uploaded_file () function moves the uploaded file to a new location.
The mkdir () function creates a directory.
The Lstat () function returns information about a file or symbolic connection.
The LinkInfo () function returns information about the connection.
The link () function establishes a hard connection.
The is_writeable () function determines whether the specified file is writable.
The is_writable () function determines whether the specified file is writable.
The Is_uploaded_file () function determines whether the specified file was uploaded via HTTP POST.
The is_readable () function determines whether the specified file name is readable.
The Is_link () function determines whether the specified file name is a symbolic connection.
The Is_file () function checks whether the specified file name is normal.
The is_executable () function checks whether the specified file can be executed.
The Is_dir () function checks whether the specified file is a directory.
The Glob () function returns the file name or directory that matches the specified pattern.
The fwrite () function writes to the file (which is safe for binary files).
The Ftruncate () function truncates the file to the specified length.
The Ftell () function is in the current position in the open file.
The Fstat () function returns information about the open file.
The fseek () function is positioned in the open file.
The fscanf () function parses input from an open file according to the specified format.
The Fread () function reads the file (which can be used safely in binary files).
The fputs () function writes to the file (which is safe for binary files).
The Fputcsv () function formats the row as CSV and writes an open file.
The Fpassthru () function outputs all the remaining data at the file pointer.
The fopen () function opens the file or URL.
The Fnmatch () function matches the file name or string according to the specified pattern.
The flock () function locks or releases files.
The filetype () function returns the type of the specified file or directory.
The FileSize () function returns the size of the specified file.
The Fileperms () function returns permissions for a file or directory.
The Fileowner () function returns the owner of the file.
The Filemtime () function returns the last modified time of the file's contents.
The Fileinode () function returns the inode number of the file.
The filegroup () function returns the group ID of the specified file.
The Filectime () function returns the last Inode modification time for the specified file.
The Fileatime () function returns the last access time for the specified file.
The file_put_contents () function writes a string to the file.
The file_get_contents () function reads the entire file into a string.
The file_exists () function checks whether a file or directory exists.
The file () function reads entire files into an array.
The FGETSS () function reads a row from an open file and filters out HTML and PHP tags.
The fgets () function reads a row from the file pointer.
The Fgetcsv () function reads a row from the file pointer and resolves the CSV field.
The FGETC () function reads a character from the file pointer.
The Fflush () function outputs the buffered content to a file.
The feof () function detects if the end of file (EOF) has been reached.
The fclose () function closes an open file.
The Diskfreespace () function returns the free space in the directory. The function is an alias of the Disk_free_space () function.
The Disk_total_space () function returns the total disk size of the specified directory.
The Disk_free_space () function returns the free space in the directory
The DirName () function returns the directory portion of the path.
The Clearstatcache () function copies the file.
The Clearstatcache () function clears the file state cache.
The Chown () function changes the owner of the specified file.
The chmod () function changes the file mode.
The CHGRP () function changes the group to which the file belongs.
The basename () function returns the file name portion of the path.
Set_exception_handler () handler () function

PHP Error and Logging functions
The Set_exception_handler () function sets the user-defined exception handling function.
The Set_error_handler () function sets the user-defined error-handling function.
The Restore_exception_handler () function restores the exception handler before it is changed by the Set_exception_handler () function.
The Restore_error_handler () function restores the previous error handler, which is changed by the Set_error_handler () function.
Error_reporting () Sets the error level for PHP and returns the current level.
The Error_log () function sends an error to the server error record, file, or remote destination.
The Error_get_last () function gets the last error that occurred.
The Debug_print_backtrace () function outputs backtrace.
Debug_backtrace () Cktrace () function

PHP Error and Logging functions
The Scandir () function returns an array that contains the files and directories in the specified path.
The Rewinddir () function resets the directory handle opened by Opendir ().
The Readdir () function returns an entry in a directory handle opened by Opendir ().
The Opendir () function opens a directory handle that can be used by Closedir (), Readdir (), and Rewinddir ().
The GETCWD () function returns the current directory.
The Closedir () function closes the directory handle opened by the Opendir () function.
The Dir () function opens a directory handle and returns an object. This object consists of three methods: Read (), rewind (), and Close ().
The chroot () function changes the root directory of the current process to the specified directory.
The ChDir () function changes the current directory to the specified directory.
The time () function returns the Unix timestamp for the current time.
The strtotime () function resolves the datetime description of any English text to a Unix timestamp.
The strptime () function resolves the date/time generated by strftime ().
The strftime () function formats the local time/date according to the locale setting.
The Mktime () function returns a Unix timestamp for a date.
The Microtime () function returns the current Unix timestamp and the number of microseconds.
The localtime () function returns the local time (an array).
The Idate () function formats the local time/date as an integer.
The Gmstrftime () function formats the GMT/UTC time/date based on local locale settings.
The Gmmktime () function obtains a UNIX timestamp for the GMT date.
The Gmdate () function formats the GMT/UTC date/time.
The Gettimeofday () function returns an array containing the current time information.
The GETDATE () function obtains the date/time information.
The date () function formats a local time/date.
The Date_sunset () function returns the sunset time for the specified date and place.
The Date_sunrise () function returns the sunrise time for the specified date and place.
The Date_default_timezone_set () function sets the default time zone for all date/time functions used in the script.
The Date_default_timezone_get () function returns the default time zone used by all date-time functions in the script.
The Checkdate () function validates a trellis-high-date.
The UNIXTOJD () function converts a Unix timestamp to a Julian day count.
The JULIANTOJD () function converts the Julian calendar into a Julian day count.
The JEWISHTOJD () function converts the Jewish calendar into a Julian day count.
The Jdtounix () function converts the Julian day count to the Unix timestamp.
Jdtogregorian () Lian () function

PHP Array function
Jdtogregorian () Wish () function

PHP Array function
The Jdtogregorian () function converts the Julian day count to the Gregorian calendar.
The Jdtofrench () function converts the Julian day count to the calendar of the Republic of France.
The Jdmonthname () function returns the month string for the specified calendar.
The Jddayofweek () function returns the day of the week.
The GREGORIANTOJD () function converts the Gregorian calendar into a Julian day count.
The FRENCHTOJD () function converts the French Republican calendar into a Julian day count.
The Easter_days () function returns the number of days between Easter and March 21 for the specified year.
The Easter_date () function returns the Unix timestamp for the specified year of Easter midnight.
The CAL_TO_JD () function converts the specified date to a Julian day count.
The Cal_info () function returns an array that contains information about a given calendar.
The CAL_FROM_JD () function converts the Julian day count to the date of the specified calendar.
The Cal_days_in_month () function returns the number of days in one months for the specified year and calendar.
The Usort () function uses a user-defined function to sort the array.
The Uksort () function uses a user-defined comparison function to sort the array by key name and maintain the index relationship.
The Uasort () function uses a user-defined comparison function to sort the array and keep the index associated (no new keys are assigned to the element).
The sort () function sorts the values of the given array in ascending order.
The sizeof () function calculates the number of cells in an array or the number of properties in an object.
The shuffle () function rearranges the elements in the array in random order.
The Rsort () function reverses the order of the elements of the array by key values. The function is basically the same as Arsort ().
The reset () function points the inner pointer of the array to the first element and returns the value of the element.
The range () function creates and returns an array of elements that contain the specified range.
Prev () HP prev () function

PHP Array function
The POS () function is an alias of the current () function. It can return the value of the current element in the array.
The next () function moves the pointer to the current element to the position of the next element and returns the value of the current element.
The Natsort () function sorts the elements in a given array with a natural order algorithm.
The Natcasesort () function sorts the elements in a given array with a natural, case-insensitive order algorithm.
The list () function assigns values to a set of variables using the elements in the array.
The Ksort () function sorts the array by key name, preserving the original key for the array value.
The Krsort () function reverses the array by key, preserving the original key for the set value.
The key () function returns the key name of the array inside the pointer that currently points to the element.
The In_array () function searches the array for the given value.
Extract () Extract () function

PHP Array function
The end () function points the array's internal pointer to the last element and returns the value of the element, if successful.
The each () function generates an array of the key names and key values of the elements pointed to by the current internal pointer to the array, and moves the internal pointer forward.
The current () function returns the element (cell) in the array.
The count () function calculates the number of cells in an array or the number of properties in an object.
The compact () function creates an array of variables with the arguments. If an array exists in the parameter, the value of the variable in the array is also fetched.
The Asort () function sorts the array and maintains the index relationship. It is primarily used to sort the associative arrays that are important for the cell order.
The Arsort () function reverses the array and maintains the index relationship. It is primarily used to sort the associative arrays that are important for the cell order.
Array_walk_recursive () cursive () function

PHP Array function
The Array_walk () function applies a callback function to each element in the array. Returns TRUE if successful, otherwise FALSE.
The Array_values () function returns an array that contains all the key values in the given array, but does not preserve the key names.
The Array_unshift () function inserts one or more elements at the beginning of the array.
The Array_unique () function shifts the duplicate values in the array and returns the result arrays.
The Array_uintersect_assoc () function takes an index check to compute the intersection of an array and compares the data with a callback function.
The Array_uintersect () function computes the intersection of an array and compares the data with a callback function.
The ARRAY_UDIFF_UASSOC () function returns a portion of the array1 array that does not exist in the other array. The key names in the returned array remain unchanged.
The ARRAY_UDIFF_ASSOC () function returns a portion of the array1 that does not exist in the other array.
The Array_udiff () function returns an array that contains all the values in the array being compared, but not in any other parameter array, and the key name remains unchanged.
The Array_sum () function returns the sum of all the values in the array.
The Array_splice () function, like the Array_slice () function, selects a series of elements in an array, but does not return, but instead deletes them and replaces them with other values.
The Array_slice () function takes a value out of the array and returns it as a condition.
The Array_shift () function deletes the first element in the array and returns the value of the deleted element.
The Array_search () function, like In_array (), looks for a key value in the array. If the value is found, the key name of the matching element is returned. Returns False if it is not found.
The Array_reverse () function flips the order of elements in the original array, creates a new array, and returns. If the second parameter is specified as true, the key name of the element remains unchanged or the key names are lost.
The Array_reduce () function iteratively simplifies the array to a single value using a callback function. If you specify a third parameter, the parameter is treated as the first value in the array, or the final return value if the array is empty.
The Array_rand () function randomly selects one or more elements from the array and returns them.
The Array_push () function adds one or more elements (into the stack) to the end of the array of the first parameter, and then returns the length of the new array.
The array_product () function computes and returns the product of all the values in the array.
The Array_pop () function deletes the last element in the array.
The Array_pad () function inserts a specified number of elements with a specified value into an array.
The Array_multisort () function sorts multiple arrays or multidimensional arrays.
The array_merge_recursive () function, like the Array_merge () function, merges the elements of one or more arrays and appends the values in an array to the previous array. and returns an array as the result.
The Array_merge () function merges two or more arrays into an array.
The Array_map () function returns an array after the user-defined function is functional. The number of arguments that the callback function accepts should be the same as the number of arrays passed to the Array_map () function.
The Array_keys () function returns a new array that contains all the key names in the array.
The array_key_exists () function determines whether the specified key exists in an array, returns TRUE if the key exists, or false otherwise.
The Array_intersect_ukey () function calculates the intersection of an array by comparing the key names with the callback function.
The ARRAY_INTERSECT_UASSOC () function computes the intersection of an array using a user-defined callback function and compares the index with a callback function.
The Array_intersect_key () function computes the intersection of an array using the key name comparison.
The ARRAY_INTERSECT_ASSOC () function returns an array of intersections of two or more arrays.
The Array_intersect () function returns an array of intersections of two or more arrays.
The Array_flip () function returns an inverted array, and if the same value occurs more than once, the last key name is the value, and all other key names are lost.
The Array_filter () function filters the elements in the array with a callback function, and if the custom filter function returns True, the current value of the array being manipulated is included in the returned result array, and the result is a new array. If the original array is an associative array, the key name remains unchanged.
The Array_fill () function populates the array with the given values, the returned array has number elements, and the value is values. The returned array uses a numeric index, starting from the start position and incrementing. If number is 0 or less than 0, an error occurs.
Array_diff_ukey () returns an array that contains all the values that appear in the array1 but do not appear in any of the other parameter array's key names. Note that the association relationship remains unchanged. Unlike Array_diff (), comparisons are made by key names rather than values.
The ARRAY_DIFF_UASSOC () function uses a user-defined callback function (callback) to perform an index check to calculate the difference between two or more arrays. Returns an array that contains the values in Array1 but not in any other parameter array.
The Array_diff_key () function returns an array that contains all the keys in the array being compared, but not in any other parameter array.
The ARRAY_DIFF_ASSOC () function returns an array of difference sets for two arrays. The array includes all the keys and values in the array being compared, but not in any other parameter array.
The Array_diff () function returns an array of difference sets for two arrays. The array includes all of the key values in the array being compared, but not in any other parameter array.
The Array_count_values () function is used to count the occurrences of all values in an array.
The Array_combine () function creates a new array by merging two arrays, one of which is the key name and the value of the other array is the key value.
The Array_chunk () function splits an array into a new array block.
The Array_change_key_case () function converts all keys of an array to uppercase or lowercase.
Array () creates arrays with keys and values. If the key is omitted when the array is specified, an integer key is generated, starting with 0 and incrementing by 1.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.