How can indexing be utilized to access and remove specific elements from an array in PHP?

To access and remove specific elements from an array in PHP, indexing can be utilized. By specifying the index of the element we want to access or remove, we can directly target that element within the array. To access an element, we can simply use the index within square brackets. To remove an element, we can use the unset() function with the specific index.

// Accessing an element in the array
$array = [1, 2, 3, 4, 5];
$element = $array[2]; // Accessing the element at index 2

// Removing an element from the array
unset($array[3]); // Removing the element at index 3