Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • append
  • array

PHP - Append item to array

Add single item to the back of an array. Element is added to end of the array without altering the rest of the array. The length of the array increases by one.

0
450
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Using array_push

documentation

array_push({{array}}, {{item}});
php

Notes

  • Can add multiple items by adding extra arguments.
The new number of elements [int]

last update: Nov. 14, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Sort list of numbers
  • Array length
  • Concatenate two arrays
  • Get last element of array
  • Get random item from array

Other language

  • Scala
  • Python
  • JavaScript

Random task

  • Prepend item to array
  • key value list all keys
  • Create queryset from object list
  • Function default parameter
  • Add user to group
  • Blog
  • About
  • License