Version: v0.7.0 - Beta.  We welcome contributors & feedback.

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.

$letters = ['a', 'b']

$letters.push('X')
//= ['a', 'b', 'X']

$letters.pop()
//= 'X'

print($letters)
//= ['a', 'b']

See Also