In this PHP programming video we take a look at Associative Arrays, Changing and Removing Elements in PHP, unset function to Remove key-value pairs. This is based on Codecademy’s Learn PHP programming course. We are in the section “Associative Arrays”, and the lesson is, “Changing and Removing Elements”. In this lesson, we learn that the same syntax that adds new array elements is also used to change any existing elements. We also learn that we are able to remove a key-value pair from within our associative array using the unset() function. The unset() function removes the key-value pair that we specify. If the key used does not exist in the array, nothing will happen. If the key specified does exist, it will be removed using the unset() function. Learning how to remove key-value pairs from associative arrays in PHP is easy once you know the unset() function. Changing values in key-value pairs within associative arrays is also easy, as mentioned above, the syntax is the same as for adding key-value pairs. Practice changing and removing elements from associative arrays! Understand changing and removing elements from associative arrays! Thanks for watching Associative Arrays, Changing and Removing Elements in PHP, unset function to Remove key-value pairs.
This video is sponsored by The Programmer Coach: https://www.theprogrammercoach.com/