This article mainly share with you the PHP common array and string function Summary, hope to help everyone.
Common String Functions:
Remove string leading and trailing spaces and special characters trim ()//Intercept string substr (), MB_SUBSTR ()//Find the location of the first occurrence of the specified string in the target string Strpos ()// Finds the last occurrence of the specified string in the target string Strrpos ()//replacement string Str_replace () Substr_replace ()//Calculate string length strlen ()//Escape and restore the string (', ', \, NULL) addslashes () stripslashes ()//repeating string str_repeat ()//scrambled String str_shuffle ()//split string explode () array common functions//create array ()// Creates an array within the specified range ()//checks if there is a value in the array In_array ()//detects if the variable is an array is_array ()//The number of elements in the array count ()//gets some or all of the key names in the array Array_keys ()/ Gets all the values in the array array_values ()//computes all the values in the array and array_sum ()//searches for the given value's key name Array_search ()//randomly fetches one or more cells from the array array_rand ()//array sort ( do not keep index]asort () [keep index]//scrambled array shuffle ()//split fractional group Array_chunk ()//merge array array_merge ()//press element into the end of the array (into the stack) Array_push ( )