Question: I have an array of objects, any array in php.
How do i skip the last element in the foreach iteration?

Answer: 
If you don't want to delete the last array entry with pop, you could skip it like this

```
$array = array('v1','v2','v3',...)

$counter = 1;

foreach($array as $value)
{
    //do your thing in loop

    if($counter == count($array)) continue; // this will skip to next iteration if last element encountered.
    $counter++;
}

```
What you are trying to do will defeat the purpose of foreach loop. It is meant to loop through the entire array and make our job easy. 

for ex: You can get the array size using **COUNT** function in php and then can use for loop and set the limit to arraysize-2, so the last array will be omitted