mixed array_pop ( array &$array_variable );
array_pop function does the following tasks:
- It checks if the variable is an array and it’s not empty. If no, it returns null.
- Copies the last element of out the array.
- It deletes the last element out of the array.
- Then it does a
reset, which moves the array’s internal pointer to the first element in the array.
- Then it returns the copied element.
- The array to be worked on by
It returns the last element’s value (not the key) when the array is not empty. Else it returns
FALSE when each of the variables passed into the instruction meet the checks listed above.
Show It in ActionBasic
Let’s see the
array_pop function in action. In this video, you will see how it works.
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
In this video, you will go deeper into the instruction.
The following PHP constructs were mentioned in the code examples: