PHP Foreach Loop stops several loops into the iteration

I have a function call which returns the following array with nested objects.

$customerTransactionsSummary = tickethut_get_red61via_customer_transactions_summary();

Result:

Read More
Array
(
    [0] => viaApiTransactionSummary Object
        (
            [orderId] => 4139:2841
            [title] => 4139:DIONVN:110514:174803835IB
            [date] => 2014-05-11 17:48:45
        )

    [1] => viaApiTransactionSummary Object
        (
            [orderId] => 4139:4686
            [title] => 4139:WEB001:310514:164913426OS
            [date] => 2014-05-31 16:50:39
        )

    [2] => viaApiTransactionSummary Object
        (
            [orderId] => 4139:4892
            [title] => 4139:WEB001:020614:171508714RB
            [date] => 2014-06-02 17:15:08
        )

    [3] => viaApiTransactionSummary Object
        (
            [orderId] => 4139:6445
            [title] => 4139:WEB001:160614:155254808MA
            [date] => 2014-06-16 16:05:27
        )
        (...)

I am then creating a foreach loop which uses the orderId and title items and passes them to another function.

//fetch the order summary:
foreach ($customerTransactionsSummary as $customerTransactionSummary) { 
    $orderSummary = tickethut_get_red61via_order_summary($customerTransactionSummary->orderId, $customerTransactionSummary->title);
}

If I output $customerTransactionSummary inside the foreach loop it just stops after 18 iterations.

$counter = 1;
foreach ($customerTransactionsSummary as $customerTransactionSummary) { 

echo $counter;
$counter++;

$orderSummary = tickethut_get_red61via_order_summary($customerTransactionSummary->orderId, $customerTransactionSummary->title);

}

Does anybody know what could be causing this?

Related posts