Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Indexed Arrays 5:13
- Adding Array Elements 5:08
- List Quiz 5 questions
- Removing Array Elements 4:50
- Editing Array Elements 1:36
- Modifying Arrays 3 objectives
- Associative Arrays 3:48
- Associative Quiz 5 questions
- Mixing Data Types in Arrays 6:07
- Multidimensional Arrays 6:14
- Multidimensional Arrays 3 objectives
- Sorting Arrays 6:16
- Mixing and Sorting 5 questions
Well done!
You have completed PHP Arrays and Control Structures!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Let's hope our todo list is getting smaller because we're getting stuff done, so we need to be able to remove things from our list. In this video we'll look at three ways php gives us to remove an element from an array.
Documentation
array_shift: Shift an element off the beginning of array.
array_pop: Pop the element off the end of array
unset: Unset a given variable (works on more than array values)
Keep in Mind
unset($array); will remove your entire array.
Everytime you call array_shift you remove an element:
$removed = array_shift($learn);
echo 'you removed ' . array_shift($learn);
Would remove two elements from the array.
Additional Option for Modifying an Array
Array Splice: remove a portion of the array and replace it with something else
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Arikaturika Tumojenko
8,897 Points3 Answers
-
A X
12,842 Points5 Answers
View all discussions for this video
Related 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