php remove last element array

47

remove all items of an array except the last 5 in php -

$a5 = array_slice($arr, -5);

how to remove last element from php array -

if(empty($transport[count($transport)-1])) {
    unset($transport[count($transport)-1]);
}

Comments

Submit
0 Comments