function index($count_all = true) {
		if (!$this->parent) {
			return -1;
		} elseif ($count_all) {
			return $this->parent->findChild($this);
		} else{
			$index = -1;
			//foreach($this->parent->children as &$c) {
			//	if (!$c->isTextOrComment()) {
			//		++$index;
			//	}
			//	if ($c === $this) {
			//		return $index;
			//	}
			//}

			foreach(array_keys($this->parent->children) as $k) {
				if (!$this->parent->children[$k]->isTextOrComment()) {
					++$index;
				}
				if ($this->parent->children[$k] === $this) {
					return $index;
				}
			}
			return -1;
		}
	}
function index($count_all = true) {
		if (!$this->parent) {
			return -1;
		} elseif ($count_all) {
			return $this->parent->findChild($this);
		} else{
			$index = -1;
			//foreach($this->parent->children as &$c) {
			//	if (!$c->isTextOrComment()) {
			//		++$index;
			//	}
			//	if ($c === $this) {
			//		return $index;
			//	}
			//}

			foreach(array_keys($this->parent->children) as $k) {
				if (!$this->parent->children[$k]->isTextOrComment()) {
					++$index;
				}
				if ($this->parent->children[$k] === $this) {
					return $index;
				}
			}
			return -1;
		}
	}
function index ( $ count_all = true ) { if ( ! $ this -> parent ) { return - 1 ; } elseif ( $ count_all ) { return $ this -> parent -> findChild ( $ this ) ; } else { $ index = - 1 ; //foreach($this->parent->children as &$c) {
 //	if (!$c->isTextOrComment()) {
 //		++$index;
 //	}
 //	if ($c === $this) {
 //		return $index;
 //	}
 //}
 foreach ( array_keys ( $ this -> parent -> children ) as $ k ) { if ( ! $ this -> parent -> children [ $ k ] -> isTextOrComment ( ) ) { ++ $ index ; } if ( $ this -> parent -> children [ $ k ] === $ this ) { return $ index ; } } return - 1 ; } }
Index of node in parent
@param bool $count_all True to count all tags, false to ignore text and comments
@return int -1 if not found
Index of node in parent