This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Have you ever misspelled a word? Or maybe changed your mind about something? Programming is no different, and sometimes we'll need to edit an array element. In this video we'll see how to modify an element by specifying it's key.
Additional Option for Modifying an Array
There are many Array Functions for modifying arrays. A few to get you started:
array_splice: remove a portion of the array and replace it with something else.
array_combine: creates an array by using one array for keys and another for its values.
array_merge: merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up