Mysql_insert_id ()
This data item ID is obtained directly after data is inserted into the database.
Details
Http://cn2.php.net/manual/zh/function.mysql-insert-id.php
Substr
Truncate string
Str_replace
(PHP 4, PHP 5)
Str_replace-replace all occurrences of the search string with the replacement string
String replacement function
Delete array elements
For more information, see Article In string array, delete array elements (in OSO), unset is used, but there is a defect. For example, $ A is an array:
<? $ A = array ("red", "green", "blue", "yellow ");
Count ($ A); // get 4
Unset ($ A [1]); // deletes the second element.
Count ($ A); // get 3
Echo $ A [2]; // The array contains only three elements. In this example, we want to get the last element, but we get blue,
Echo $ A [1]; // No value
?>
That is to say, after the elements in the array are deleted, the number of elements in the array (obtained using count () has changed, but the array subscript has not been rearranged, you must also use the key before the array to delete the corresponding value.
Later, I used another method. In fact, it was not called a "method" at all. Instead, I used the PhP4 ready-made function array_splice ().
<? $ A = array ("red", "green", "blue", "yellow ");
Count ($ A); // get 4
Array_splice ($ A,); // deletes the second element.
Count ($ A); // get 3
Echo $ A [2]; // obtain yellow
Echo $ A [1]; // get blue
?>
Put this Program Compared with the previous one, we can see that array_splice () not only deletes the elements, but also rearranges the elements, in this way, there will be no null values (such as $ A [1] In values) between the elements of the array.
Array_splice () is actually a function to replace array elements. However, if no replacement value is added, the elements are simply deleted. The usage of array_splice () is as follows:
Array array_splice (array input, int offset [, int length [, array replacement])
The input parameter is an array to be operated. The offset parameter starts from the first element and starts from the first element when the offset parameter is negative; length is the number of elements to be replaced/deleted. If it is omitted, it starts from offset to the end of the array. It is also positive and negative. The principle is the same as offset. relacement is the value to be replaced.