Category: Php Programming

Get last entry of an array

Here is a nice way to grab the last item of an exploded string:
$my_string = ‘one-two-three-four’;
$last_item = end(explode( ‘-’, $my_string);
echo $last_item; // four

Tags: Php Programming
Posted in Php Programming | Leave a comment