← All built-ins / array_push()
array_push()
array_push(...$args): int
Parameters
| Name | Type | Description |
|---|---|---|
| $a | array | array (by reference) |
| $... | mixed | values to append |
Return value
New element count. $arr[] = v does the same for one value.
Example
$a = [1];
$n = array_push($a, 2, 3);
echo $n, " ", implode(",", $a);3 1,2,3