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
How can I mix up the order of values in an array?How can I sort an array keeping the correlation between the index and value?
How do I reverse sort an array by key?
How can I display a 2 dimensonal array?
how can you reset an array in PHP
