Some of the commonly used are written here, encountered on the add ~
String functions (Common):
substr (): String intercept
substr ($string, StartIndex, $length);
If $length is a negative number, starting at the end, start with the first character
The length is less than start and returns false;
Return value: truncated string
htmlspecialchars (): Prevent code parsing
strlen ():
Gets the string length, str is empty, returns 0
Strlen ($STR);
explode (): Cut string to Array
Explode ("/", $str, limit);
Limit: Refers to the number of elements that delimit the array;
Trim (): Remove the string leading or trailing blanks or other (end-to-end) characters
Trim ($string, "F");
If there is no second argument, the removed character is \ t \ r \ n \x0b
Return value: Returns the stripped string
Array functions (Common):
In_aray (): Determine if an element exists in the array
In_array ($need, $array, False/true)
$need: If it is a string, case-sensitive
The third parameter, if true, checks whether the $need type and $array are the same
Return value: Found $need returns true, not found true;
Cases:
$array = [1,2,3,4,5];in_array (3, $array, True)//returns True;in_array ("3", $array, true);//returns False because "3" is a string
COUNT (): counts the number of elements in an array or the number of attributes in an object
Count ($array/$obj);
PHP Learning Articles ~ functions