Php:
- Array_shift ()-Moves the cell at the beginning of the array to a group
- Array_unshift ()-inserts one or more cells at the beginning of the array
- Array_push ()-presses one or more cells into the end of the array (into the stack)
- Array_pop ()-Popup array last cell (out of stack)
- Array_splice ()-Removes a part of the array and replaces it with other values
- Array_slice ()-remove a paragraph from the array
Js:
Elements are added
Arrayobj. Push ([Item1 [item2] [... [Itemn]]); /Adds one or more new elements to the end of the array and returns the new length of the array
Arrayobj.unshift ([Item1 [item2 [...] [Itemn]]); /Adds one or more new elements to the beginning of the array, the elements in the array are automatically moved back, returning the new length of the array
Arrayobj.splice (insertpos,0,[item1[, item2[, ... [, Itemn]]]); /inserts one or more new elements into the specified position of the array, the element at the insertion position automatically moves back, and returns "".
Deletion of elements
Arrayobj.pop (); Removes the last element and returns the element value
Arrayobj.shift (); Removes the first element and returns the element value, and the elements in the array are automatically moved forward
Arrayobj.splice (Deletepos,deletecount); Removes the specified number of DeleteCount elements from the specified position deletepos, returning the removed element as an array
Interception and merging
Arrayobj.slice (start, [end]); Returns a portion of the array as an array, noting that the element of end is not included, and if the end is omitted, all elements after start are copied
Arrayobj.concat ([item1[, item2[, ... [, Itemn]]]); Concatenate multiple arrays (which can also be strings, or a mixture of arrays and strings) into an array, returning a new, well-connected array
Copy
Arrayobj.slice (0); Returns a copy array of the array, note that it is a new array, not a pointer to the
Arrayobj.concat (); Returns a copy array of the array, note that it is a new array, not a pointer to the
Sort
Arrayobj.reverse (); Reverses the element (the top row to the last and last to the top), returning the array address
Arrayobj.sort (); Sort the array elements, returning the address of the arrays
PHP-JS Array Operations