public function insert($index, $child, $replace = FALSE)
	{
		if ($child instanceof self || is_scalar($child)) {
			if ($index === NULL) { // append
				$this->children[] = $child;

			} else { // insert or replace
				array_splice($this->children, (int)$index, $replace ? 1 : 0, [$child]);
			}

		} else {
			throw new InvalidArgumentException(sprintf('Child node must be scalar or Html object, %s given.', is_object($child) ? get_class($child) : gettype($child)));
		}

		return $this;
	}
public function insert($index, $child, $replace = FALSE)
	{
		if ($child instanceof self || is_scalar($child)) {
			if ($index === NULL) { // append
				$this->children[] = $child;

			} else { // insert or replace
				array_splice($this->children, (int)$index, $replace ? 1 : 0, [$child]);
			}

		} else {
			throw new InvalidArgumentException(sprintf('Child node must be scalar or Html object, %s given.', is_object($child) ? get_class($child) : gettype($child)));
		}

		return $this;
	}
public function insert ( $ index , $ child , $ replace = FALSE ) { if ( $ child instanceof self || is_scalar ( $ child ) ) { if ( $ index === NULL ) { // append $ this -> children [ ] = $ child ; } else { // insert or replace array_splice ( $ this -> children , ( int ) $ index , $ replace ? 1 : 0 , [ $ child ] ) ; } } else { throw new InvalidArgumentException ( sprintf ( 'Child node must be scalar or Html object, %s given.' , is_object ( $ child ) ? get_class ( $ child ) : gettype ( $ child ) ) ) ; } return $ this ; }
Inserts child node.

@param  int|NULL position or NULL for appending
@param  Html|string Html node or raw HTML string
@param  bool
@return self
@throws InvalidArgumentException
Inserts child node .