Concept
How does unset() remove elements from a PHP array?
ComputerScienceOne / Removing Elements
"You can remove elements from an array using the unset() function. This function only removes the element from the array, it does not shift other elements down to fill in the unused index.\n\n$arr = array(10, 20, 30);\n\nunset($arr[1]);\n\nprint_r($arr);\n\nThis example would result in the following.\n\nArray ( [0] => 10 [2] => 30 )\n\nFurther, you can use unset() to destroy all elements in the array."
Related Ideas
- What does unset($arr) do to an array?ComputerScienceOne · Using Arrays in Functions
- What section covers using arrays in functions?ComputerScienceOne · Removing Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- How do you deallocate dynamically allocated arrays?ComputerScienceOne · Using Arrays with Functions
- How can you count the elements in a PHP array?ComputerScienceOne · Useful Functions
- How can you print the contents of a PHP array in a readable format?ComputerScienceOne · Useful Functions