I am trying to target the last child of an array (within a foreach statement) to enable me to slightly adjust the output of just this item. I have tried numerous approaches but not having any breakthroughs. My loop is very simple:
// Loop through the items
foreach( $array as $item ):
echo $item;
endforeach;
The above works fine, but I want to change the output of the final item in the array to something like:
// Change final item
echo $item . 'last item';
Is this possible?