This article describes how php uses unset () to delete a unit (key) in an array. The example shows how to use the unset function to delete an array unit, for more information, see
This article describes how php uses unset () to delete a unit (key) in an array. The example shows how to use the unset function to delete an array unit, for more information, see
This example describes how php uses unset () to delete a cell (key) in an array. Share it with you for your reference. The specific analysis is as follows:
Unset can delete a variable or a unit in the array. However, it should be noted that the array will not be re-indexed.
Example:
<? Php $ arr = array ("Chaoyang District", "Haidian District", "Xicheng district", "Dongcheng District", "Fengtai District"); unset ($ arr [3]); echo"
"; Print_r ($ arr);?>The output result is as follows:
Array ([0] => Chaoyang District [1] => Haidian District [2] => Xicheng district [4] => Fengtai District)
I hope this article will help you with php programming.