1, array de-weight (array_unique):
<?php
$a =array ("a" and "cat", "B" and "Dog", "c" = "cat");
Print_r (Array_unique ($a));
?>
Output:
Array ([A] = Cat [b] = Dog)
2, array, string sort (sort):
Sort (array,sortingtype);
Array: Required. Specifies the array to be sorted.
Sortingtype:
Optional. Specifies how to compare elements/items of an array. Possible values:
- 0 = sort_regular-default. Arrange each item in the usual order (standard ASCII, no change type)
- 1 = sort_numeric-Each item is treated as a number.
- 2 = sort_string-Each item is treated as a string.
- 3 = sort_locale_string-handles each item as a string, based on the current locale (can be changed by setlocale ()).
- 4 = sort_natural-handles each item as a string, using a natural sort similar to Natsort ().
- 5 = sort_flag_case-You can sort strings by combining (bitwise OR) sort_string or sort_natural, not case-sensitive.
Several useful small functions (array de-weight, array, string sort)