One way to remove an item from an array is to use the
indexOf method to get the index of the item we want to remove.
Then we can use the
splice method to remove an item with the given index.
For instance, we can write:
What is PHP: - Who invented PHP, how it works, answers to all such questions about PHP, and much other information, you are going to