Skip links

PHP add element to an array

How to add new element to an array using php.array_push() php core function can be use for this.It will adding new element to ad array.

$original = array( 'one','two','three','four','five' );
// before inserting
print_r($original);
echo '
'; // after inserting array_push($original,'THIS IS NEW'); print_r($original);