array_pop() is the counterpart to array_shift().
It removes the last element from an array and returns the element's value.
<?php $myBook = array("title"=> "Java", "author"=> "John A", "pubYear"=> 2018); echo array_pop($myBook)."\n"; // Displays"2018" print_r($myBook);//from w ww.ja va 2 s . c o m ?>