1$myArr = [1, 2, 3, 4];
2
3array_push($myArr, 5, 8);
4print_r($myArr); // [1, 2, 3, 4, 5, 8]
5
6$myArr[] = -1;
7print_r($myArr); // [1, 2, 3, 4, 5, 8, -1]
1
2<?php
3$stack = array("orange", "banana");
4array_push($stack, "apple", "raspberry");
5?>
6
7
1<?php
2 $z = ['me','you', 'he'];
3 array_push($z, 'she', 'it');
4 print_r($z);
5?>
1<?php
2
3$a=array("red","green");
4
5array_push($a,"blue","yellow");
6
7print_r($a);
8?>
1<?php
2// Insert "blue" and "yellow" to the end of an array:
3
4
5$a=array("red","green");
6array_push($a,"blue","yellow");
7print_r($a);
8?>
1<?php
2 $myArray = array(); // Init empty array
3
4 $myArray[] = $value; // Add value to the array
5?>