Skip to content Skip to sidebar Skip to footer

PHP add element to an array

Reading Time: < 1 minute

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
echo '
'; // after inserting array_push($original,'THIS IS NEW'); print_r($original);