public function indexOf(callable $callback) {
    foreach ($this->nodes as $i => $node) {
      if ($callback($node)) {
        return $i;
      }
    }
    return -1;
  }
public function indexOf(callable $callback) {
    foreach ($this->nodes as $i => $node) {
      if ($callback($node)) {
        return $i;
      }
    }
    return -1;
  }
public function indexOf ( callable $ callback ) { foreach ( $ this -> nodes as $ i => $ node ) { if ( $ callback ( $ node ) ) { return $ i ; } } return - 1 ; }
Index of first element that is matched by callback.

@param callable $callback
Callback to test for node match.

@return int
Index of first element that is matched by callback.
Index of first element that is matched by callback .