Question: PLEASE DO IN PHP Define an array that contains the following elements: apple, banana, cherry, date, elderberry. Using a loop, print out each element of
PLEASE DO IN PHP
Define an array that contains the following elements: "apple", "banana", "cherry", "date", "elderberry".
Using a loop, print out each element of the array in a separate paragraph tag.
Create a variable called $count and initialize it to 0.
Print out the total number of elements in the array using the $count variable.
Using a loop, add the word "fruit" to the end of each element in the array. For example, "apple" should become "apple fruit".
Using a loop, print out each element of the array with the new word "fruit" in a separate paragraph tag.
Create a new array called $fruits with the following elements: "apple", "banana", "cherry".
Using a loop, remove all elements from the original array that are also in the $fruits array.
Using a loop, print out the final contents of the original array in a separate paragraph tag.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
