Remove the last element of an array – PHP

<?php
 $sampleDate = array("Test1", "Test2", "Test3", "Test4");
 array_pop($sampleDate);
 print_r($sampleDate); // Array ( [0] => Test1 [1] => Test2 [2] => Test3 ) .
 // Test4 will be removed
?>
Share

Leave a Reply

Your email address will not be published. Required fields are marked *