PHP functions

Source: Internet
Author: User

Tags:

The Array_merge function and the addition of two arrays, the Array_merge function, in the same index array, will be the array of two arrays, the index of the array, the first array to add the maximum index, if it is an associative array, the value of the subsequent array overrides the previous value, for the addition , regardless of whether the first occurrence of the index or associative array, the previous value, followed by the Discard Array_chunk function array to cut, the first parameter is to be cut, the second parameter is cut after the number of elements in each array, the third split after the index of each array to use the original array index name , the default is not to try the next function to return the value of the next element of the current array element, move the pointer back one bit, there is no return Falseprev function returns the previous element of the current element, and move the pointer forward one bit, The return TrueEnd function returns the value of the last element of the array, the current function returns an array of elements, does not move the position of the sort function to the value of the group element, is sorted in a forward order, succeeds returns TRUE, the failure returns false, the first argument is the array to sort, The second parameter is the ordered rule, which removes all sorted array original index values, sorts the values of the Rsort function to add a new index value, reverses the order of the elements, returns true successfully, fails returns false, the first argument is the array to sort, the second parameter is the ordered rule, The function deletes all sorted array original index values, adds new index values after sorting, asort functions The values of the array elements, sorts them in a forward order, saves the index relationship, returns true successfully, fails returns false, the first parameter is the array to sort, the second parameter is the ordered rule, The function maintains the corresponding relationship of the original key value, ksort the key of the array element, sorts it in a forward order, returns true successfully, fails returns false, the first parameter is the array to sort, the second parameter is the ordered rule, The function maintains the original key-value correspondence shuffle function randomly sorts array elements, deletes the original key-value relationship, returns true successfully, does not successfully return the Falsearray_reverse function to sort the array elements in the reverse direction of the original order, the second parameter is a sorted array, The second parameter, if set to true, preserves the original relationship after sorting, by default the Falsereset function resets an array, moves the inner pointer in the array to the cell where the first element of the array is located, and returns the Falselist function to assign the elements of the array to the variable if the data is empty. Array for indexed array The range function quickly creates an array of the specified range, the first parameter number is the start value, the second argument is the ending value, the third argument is the span, and the default is a Array_push function that presses one or more elements into the arrayAt the end, the execution succeeds in returning the number of cells that are pressed into the array array_pop function pops the last element of the array, returns the last cell of the array, minus one of the array's length, and if the array is empty or the array is not returned NULL, the array pointer is used to point to the first array cell Array_ The Change_key_case function will replace all the case of the string as an array index, the first parameter is a number, the second parameter specifies that the intersection of the array is computed in uppercase or lowercase array_intersect functions, can have more than one parameter, and the corresponding relationship of the key value is invariant Array_ Flip function Index and value Exchange Array_fill function to set some or all of the elements in the array to a value, the first parameter is the start index to fill the element, the second parameter is the number of padding, the third parameter is the element value to fill the Count function counts the number of elements in the array Array_ count_values function Statistics Array, the number of times the value of the Array_key_exists function checks whether the given index exists in the array, returns true if it exists, or returns the Falsearray_keys function to get all the index names in the array. The first parameter is the array itself, the second is the key value to select, the default is all, you can specify a key value, to find, and the third parameter is used to compare the ARRAY_MAP function to the given array In_array function to determine whether a value exists in the array, If there is a return of true, no in return false, the first parameter is the value you are looking for, the second parameter is an array, the third parameter is used to compare the key function from the associative array to get the current pointer of the element's name strcmp function compares two strings, If str1 str2 returns 0 if STR1 is less than str2 returns-1, if STR1 is greater than str2 returns a number greater than 0 Str_replace function replaces all $search portions of str in the string with string $replace, and returns the replaced string, the first parameter is the data to be replaced, the second parameter is replaced by the value, the third argument is the string to be manipulated, the fourth parameter is the number of times the substitution occurred, the first and second arguments to the array, the corresponding relationship Substr_ The Replace function first argument is the string to be processed, the second argument is the string to replace, the third argument is where the string begins to replace, and if Start is a positive number, the substitution starts at the start position of the string. , if start is a negative number, the substitution starts at the bottom-starting position of string. The third parameter is the replacement length, if the parameter is set and is a positive number, which indicates that the string isThe length of the substituted substring. If set to negative, it represents the number of characters at the end of the substring to be replaced at the ends of the string. If this parameter is not provided, it defaults to strlen (string). Of course, if length is 0, then the function is to insert replacement into the start position of string. The sprintf function formats the string, the first argument is the format to be converted, usually begins with%, until the character is converted, the second parameter is the data to be formatted substr the function gets a substring in the string, the first argument is the string to be processed, the second argument is the start position, The third argument is to intercept the length of the RTrim function to delete the whitespace character at the end of the string (or other specified characters), the first parameter is the string to be processed, the second parameter is the character you specify, not the default LTrim function to delete the whitespace character starting with the string (or other specified characters), The first parameter is the string to be processed, the second argument is the character you specify, the default Trim function is not specified to remove the whitespace character at the beginning and end of the string (or other specified characters) the strlen function gets the length of a string Mb_strlen function gets the length of a string, The first argument is the string to get the length, the second argument is the character set to be specified the Strtoupper function converts all letters in the string to uppercase letters Strtolower function converts all letters in a string to lowercase letters str_repeat function is used to repeatedly generate a string , the first argument is the string to be repeated, the second argument is the number of times to repeat the Str_split function divides the string into an array, the first parameter is the string to be processed, the second argument is the length of the cut file_put_contents the first parameter is the path to write to the file, The second parameter is the content to write, the write file does not exist when it is created automatically, the default is replace write, the third parameter is File_append, and the return value is the number of bytes written. The file_get_contents function gets the file contents of the specified path, The read file is too large to use, the return value for the resulting content fopen function The first parameter is the path to open the file, the second argument is to open the file is r,w (the file does not exist automatically created, the contents of the file will be emptied), a,x (the file can not be created automatically, the contents of the file will be emptied), r+,w+,a+,x+, the return value is the file resource fwrite function The first parameter is an open file resource, the second parameter is the read-length string content, the size is byte, the maximum is 8,192 bytes fgets The first parameter is the file resource, the secondA parameter is a string that reads a specified length,       

PHP functions

Related Article

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.

Tags Index: