PHP Code Completion Easy +10 XP
Array Push
Complete to add an element to an array.
PHPFill in the blank
$fruits = ["apple", "banana"];
___($fruits, "cherry");Type the missing code
Show answer and explanation
Answer: array_push
array_push() appends one or more elements to the end of an array. Alternatively, use $fruits[] = 'cherry'.
Hint: Which function adds to the end of an array?
What this challenge tests
Code Completion in PHP: arrays, functions.