public function substitute( array $substitute )
	{
		foreach( $substitute as $marker => $value )
		{
			$begin = 0;
			$mbegin = (string) str_replace( '$', $marker, $this->_begin );
			$mend = (string) str_replace( '$', $marker, $this->_end );

			while( ( $begin = strpos( $this->_text, $mbegin, $begin ) ) !== false )
			{
				if( ( $end = strpos( $this->_text, $mend, $begin + strlen( $mbegin ) ) ) === false )
				{
					throw new MW_Template_Exception( sprintf( 'Error finding end of marker "%1$s" in template', $marker ) );
				}

				$this->_text = substr_replace( $this->_text, $value, $begin, $end + strlen( $mend ) - $begin );
			}
		}

		return $this;
	}
public function substitute( array $substitute )
	{
		foreach( $substitute as $marker => $value )
		{
			$begin = 0;
			$mbegin = (string) str_replace( '$', $marker, $this->_begin );
			$mend = (string) str_replace( '$', $marker, $this->_end );

			while( ( $begin = strpos( $this->_text, $mbegin, $begin ) ) !== false )
			{
				if( ( $end = strpos( $this->_text, $mend, $begin + strlen( $mbegin ) ) ) === false )
				{
					throw new MW_Template_Exception( sprintf( 'Error finding end of marker "%1$s" in template', $marker ) );
				}

				$this->_text = substr_replace( $this->_text, $value, $begin, $end + strlen( $mend ) - $begin );
			}
		}

		return $this;
	}
public function substitute ( array $ substitute ) { foreach ( $ substitute as $ marker => $ value ) { $ begin = 0 ; $ mbegin = ( string ) str_replace ( '$' , $ marker , $ this -> _begin ) ; $ mend = ( string ) str_replace ( '$' , $ marker , $ this -> _end ) ; while ( ( $ begin = strpos ( $ this -> _text , $ mbegin , $ begin ) ) !== false ) { if ( ( $ end = strpos ( $ this -> _text , $ mend , $ begin + strlen ( $ mbegin ) ) ) === false ) { throw new MW_Template_Exception ( sprintf ( 'Error finding end of marker "%1$s" in template' , $ marker ) ) ; } $ this -> _text = substr_replace ( $ this -> _text , $ value , $ begin , $ end + strlen ( $ mend ) - $ begin ) ; } } return $ this ; }
Substitutes the marker by given text.

@param array $substitute Array of marker names (keys) and text to substitute (values)
@return MW_Template_Interface Own Instance for method chaining
Substitutes the marker by given text .