gan_node_html.php
function getChildrenByCallback($callback, $recursive = true, $check_self = false) {
		$count = $this->childCount();
		if ($check_self && $callback($this)) {
			$res = array($this);
		} else {
			$res = array();
		}

		if ($count > 0) {
			if (is_int($recursive)) {
				$recursive = (($recursive > 1) ? $recursive - 1 : false);
			}

			for ($i = 0; $i < $count; $i++) {
				if ($callback($this->children[$i])) {
					$res[] = $this->children[$i];
				}
				if ($recursive) {
					$res = array_merge($res, $this->children[$i]->getChildrenByCallback($callback, $recursive));
				}
			}
		}

		return $res;
	}
function getChildrenByCallback($callback, $recursive = true, $check_self = false) {
		$count = $this->childCount();
		if ($check_self && $callback($this)) {
			$res = array($this);
		} else {
			$res = array();
		}

		if ($count > 0) {
			if (is_int($recursive)) {
				$recursive = (($recursive > 1) ? $recursive - 1 : false);
			}

			for ($i = 0; $i < $count; $i++) {
				if ($callback($this->children[$i])) {
					$res[] = $this->children[$i];
				}
				if ($recursive) {
					$res = array_merge($res, $this->children[$i]->getChildrenByCallback($callback, $recursive));
				}
			}
		}

		return $res;
	}
function getChildrenByCallback ( $ callback , $ recursive = true , $ check_self = false ) { $ count = $ this -> childCount ( ) ; if ( $ check_self && $ callback ( $ this ) ) { $ res = array ( $ this ) ; } else { $ res = array ( ) ; } if ( $ count > 0 ) { if ( is_int ( $ recursive ) ) { $ recursive = ( ( $ recursive > 1 ) ? $ recursive - 1 : false ) ; } for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ callback ( $ this -> children [ $ i ] ) ) { $ res [ ] = $ this -> children [ $ i ] ; } if ( $ recursive ) { $ res = array_merge ( $ res , $ this -> children [ $ i ] -> getChildrenByCallback ( $ callback , $ recursive ) ) ; } } } return $ res ; }
Finds children using a callback function
@param callable $callback Function($node) that returns a bool
@param bool|int $recursive Check recursively
@param bool $check_self Include this node in search?
@return array
Finds children using a callback function