I've got following array, and what I'm trying to achieve is remove all null
values after i
value.
Original array:
$a = ["a", "b", null, null, null, null, "i", null, null, null, null];
Desired result:
$a = ["a", "b", null, null, null, null, "i"];
Things I've tried: So I had an idea, to filter array from empty values using array_filter, get index of the last value, then get index of the last item in the original array, and unset that range using for loop, but that does not seems like an efficient solution to me. So my question is are there any other, more efficient ways of achieving that? Thanks.