Is repeatedly loading a helper in a loop bad for performance?

Permalink
Hello all

This might be a silly question but I thought I'd see what the community thinks. I'm writing some functions to pull out users' avatars for use in my site's footer, like so:

Class Controller extends Concrete5_Library_controller {
public function getFooterMembers() {       
        $userList = new UserList(); 
        $userList->filterByGroup("Members");
        $userList->filterByIsActive(1);
        $userList->filter('u.uHasAvatar', 1);
        $userList->sortBy('uDateAdded', 'asc'); 
        $users = $userList->get(5);
        $memArray = array();
        foreach ($users as $u) {
            $memArray[] = $this->getUserBadge($u);                        
        }
        shuffle($memArray);
        return $memArray;
    }


My question is whether it's inefficient to load $ah with each call of the getUserBadge() function. My instinct is that it is, but can anyone confirm this? Is there a way to define a helper "class-wide" so it's instantiated once but used many times?

This is probably quite basic PHP/Zend but there you go. Many thanks for any help :)

melat0nin