![]() Also, we will learn how to traverse or loop through this array. In the following example, we have created a 2-d array containing the information of books like the author of the book, type of book, and published in the year. To delete an element of the 2D array we will use array_shift() function.Īrray_shift removes and returns the first element value of the array. To update an element of the 2D array just get the key from the array and replace the value of that key in a particular array. How to Update Elements of 2D Arrays in PHP? In the below program we just remove the key “colors”, and found that it appends to the last of the given array with a 0 key as shown in the output image.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |