I have an array that will vary in number of elements. How can I return just the last item of an array?
For example:
$mytest = explode(",", $example);
In one case:
$example = "milk,eggs";
Another:
$example = "eggs,shampoo,batteries";
Another:
$example = "bread,juice,diapers,cookies,cakes,ice cream";
So, I want to return:
In case one: eggs
In case two: batteries
In case three: ice cream
Can someone help me out here?