PHP array_push() is an inbuilt function that is used to add new elements to an array. The array_push() function is used to insert new items at the end of an array and get the updated number of array elements. An array stores multiple values in one single variable.

PHP add to array is an operation in which we append elements to the existing array. An array can contain many values under a single name, and you can access the values by referring to an index number.

In PHP, there are three types of array.

  1. Indexed arrays – Arrays with the numeric index.
  2. Associative arrays – Arrays with the named keys.
  3. Multidimensional arrays – Arrays that are containing one or more arrays.

Now, let’s see an example where we perform PHP to add to array operations.

#php #**php array_push

PHP array_push() Function | PHP Add to Array Example
1.15 GEEK