List.push
push($item) -> self
Description
Add an item to the end of a List.
This function is the opposite of pop.
To add an item elsewhere in a List, use insert.
JargonThe terms “push” and “pop” come from observing a spring-loaded stack of plates in a cafeteria. New plates are added to the stack by pushing them on top. The top-most plate is removed by “popping” it off.
$letters = ['a', 'b']
$letters.push('X')
//= ['a', 'b', 'X']
$letters.pop()
//= 'X'
print($letters)
//= ['a', 'b']