for whatever reason $post is definitely < . The indoxOf function is effective. I apply it to ohter codes and delay pills work great

for whatever reason despite I add the element such as this array_push($groups, $tempDon); around the next loop i is constantly on the return -1

$donations = $this->getInstitutionDonations($post->ID);

            $groups=array();

            foreach( $donations as $don ) : setup_postdata($don); 

                $pos = $this->indexOf($don, $groups);

                print_r($pos);

                if($pos < 0)
                {
                    $tempDom = $don;

                    $tempDon->count = 1;

                    array_push($groups, $tempDon);
                }
                else
                {
                    $tempDom = $groups[$pos];

                    $tempDon->count++;

                    array_splice($tempDon);

                    array_push($groups, $tempDon);

                    echo '<br><br><br>ahhhhhhhhhh<br><br>';
                }
            endforeach;

     protected function indexOf($needle, $haystack) {            // conversion of JavaScripts most awesome
        for ($i=0;$i<count($haystack);$i++) {         // indexOf function.  Searches an array for
                if ($haystack[$i] == $needle) {       // a value and returns the index of the *first*
                        return $i;                    // occurance
                }
        }
        return -1;
    }

This appears like an problem of poor proofreading in my experience (note $tempDom versus $tempDon):

                $tempDom = $don;

                $tempDon->count = 1;

                array_push($groups, $tempDon);

Your else block has similar issues.

I additionally completely accept @hakre's comment regarding syntax incongruencies.

EDIT

I'd like to suggest that you take advantage of PHP's built-in array_search function in your body of the indexOf method instead of moving your personal.