public function indexWhere($callable)
    {
        foreach ($this->elements as $i => $element) {
            if (call_user_func($callable, $element) === true) {
                return $i;
            }
        }

        return -1;
    }
public function indexWhere($callable)
    {
        foreach ($this->elements as $i => $element) {
            if (call_user_func($callable, $element) === true) {
                return $i;
            }
        }

        return -1;
    }
public function indexWhere ( $ callable ) { foreach ( $ this -> elements as $ i => $ element ) { if ( call_user_func ( $ callable , $ element ) === true ) { return $ i ; } } return - 1 ; }
Finds the first index where the given callable returns true.

@param callable $callable

@return integer the index, or -1 if the predicate is not true for any element.
Finds the first index where the given callable returns true .