array_push() / []
Adds an element to the array.
Syntax
$arr[] = value; · array_push($arr, value)
Description
$arr[] = x is the shortest way to add; array_push does the same.
Example
Loading editor…
Expected output
apple,pear
When to use?
Growing lists.