public static function last($array, $n = 1, $guard = false)
    {
        $array = static::toArray($array);
        $result = array_values(array_slice($array, -$n));
        return $guard || isset($result[1]) ? $result : $result[0];
    }
public static function last($array, $n = 1, $guard = false)
    {
        $array = static::toArray($array);
        $result = array_values(array_slice($array, -$n));
        return $guard || isset($result[1]) ? $result : $result[0];
    }
public static function last ( $ array , $ n = 1 , $ guard = false ) { $ array = static :: toArray ( $ array ) ; $ result = array_values ( array_slice ( $ array , - $ n ) ) ; return $ guard || isset ( $ result [ 1 ] ) ? $ result : $ result [ 0 ] ; }
Returns the last element of an array. Passing n will return the last n elements of the array. Passing guard
will force the returned value to be an array.

@category Array Functions

@param traversabel $array the list of items
@param int $n optional, the number of items to pick
@param bool $guard optional, true to always return an array

@return mixed,array
Returns the last element of an array . Passing n will return the last n elements of the array . Passing guard will force the returned value to be an array .