Advertisement
touhid_xml

Remove last element from array in PHP

Sep 5th, 2015
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.20 KB | None | 0 0
  1. <?php
  2. $arr = range(1000,1200); //generate set of number in array
  3.  
  4. $lastKey = count($arr) -1 ; //last key
  5. unset($arr[$lastKey]); //unset last array element
  6.  
  7. var_dump($arr); exit(); //debug the array
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement