Modifying Array Elements - why


UNIT 4: Arrays
Lesson 6: Modifying Array Elements

I am not having an issue with this exercise per se, rather my question has to do with real world application of modifying array elements. Why would you do this? In what cases would this be practical or useful?


        $languages = array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby");
         $languages[3] = "Not a language";
        echo $languages[3];

Why would I want to do that? Why would I want to modify the array element 'Python'?


I guess really organizing,

Let's say you have
Eggs, Milk, Flour, Baking powder, and bananas.

Obviously these all cost something at a grocery store so they have a value

Organizing them like

Eggs = this amount
and milk = this amount

Getting prices at a grocery store I guess...

Another could be if you are trying to work with different companies and you need to know the values with priorities and everything

Maybe this helps?


I picked two Articles, so you can get the feel....