PHP Tutorial Data Additions, deletions, queries, sorting details The addition of an array (the top and end data are added (without limiting the number of bars) and the data operation is added anywhere in the middle). 2~ the deletion of the array (the end of data deletion (not qualifying), as well as data deletion at any point in the middle, conditions: the middle position of the array is deleted, the following values move forward, followed by the previous position. 3~ sort operations on data (sorting operations, to be efficient). 4~ an array of queries (one of the data in an array, if satisfied, then generate a new array, the new array is to meet the query conditions, conditions: query, not query a certain value, and query a certain value to meet a certain condition, for example: query array of a value greater than 5, all filtered out)
1, the array in PHP is essentially a map structure, for indexed arrays, add or delete elements, it does not index. 2. Avoid mixed index arrays and associative arrays The rest of the requirements to find the PHP manual should have an answer. To tell you the truth, I can't remember so many functions. 3. Default bubble sort, heap sort, quick sort, insert sort, two points. Look at your needs. 4. or cycle. PHP arrays are powerful but inefficient
2 The deletion of the array, indexed by the string, is directly deleted on OK. unset Numeric-indexed, unset deletes, and then uses array_values to reset the array. 3 Usort Sorting, you can use the callback function to implement the algorithm. Efficiency mainly depends on how you write the algorithm.
1~ The addition of an array (the data is added (without limiting the number of bars) and any position in the middle to add data operations). Arrar_unshift (Add data to array header) Array_push (add array at the end of array) Arrar_fill (added at any point in the middle) 2~ the deletion of the array (the end of data deletion (not qualifying), as well as data deletion at any point in the middle, conditions: the middle position of the array is deleted, the following values move forward, followed by the previous position. Array_shift (array header delete data) Array_pop (array is not deleting data)
Array_slice does not cause any changes to the original array, I want to say array_splice. just looked at the next manual, found that the Array_splice function is very powerful, the number of any location of the array of additions and deletions can be done with Array_splice. about the problem of rebuilding a digital index on a non-hash array, both Array_merge and array_values can be tested earlier, the latter faster
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.