How to add elements to the end of an array in PHP

  743 views   1 year ago PHP

Use the PHP array_push() function

You can use the PHP array_push() function to insert one or more elements or values at the end of an array. Let's try out an example and see how this function works:

$skills = array("HTML5", "CSS3", "JavaScript");
// Append array with new items
array_push($skills, "jQuery", "PHP");


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]

Related Articles