How do I remove and view the last element of an array?
<?php
$values = array("I","Like","Sentences","That","Don't","Finish");
$discard = array_pop($values);
echo "Bye bye to $discard...\n\n";
$sentence = implode(" ",$values);
echo "$sentence";
?>
Which gives us the following output:
Bye bye to Finish...
I Like Sentences That Don't
Comment on this Question and Answer >>>
ASK A QUESTION
More arrays PHP Questions
sortHow do I reverse the order of the elements in an array?
I have an array of numbers and many repeat, how to list all items in order of maximum occurence?
How do I pick a random value from an array?
How to point internal pointer to first element of an array?
