interleave_changed_lines example

        $r = '';

        /* * Does the aforementioned additional processing: * *_matches tell what rows are "the same" in orig and final. Those pairs will be diffed to get word changes. * - match is numeric: an index in other column. * - match is 'X': no match. It is a new row. * *_rows are column vectors for the orig column and the final column. * - row >= 0: an index of the $orig or $final array. * - row < 0: a blank row for that column. */
        list($orig_matches$final_matches$orig_rows$final_rows) = $this->interleave_changed_lines( $orig$final );

        // These will hold the word changes as determined by an inline diff.         $orig_diffs  = array();
        $final_diffs = array();

        // Compute word diffs for each matched pair using the inline diff.         foreach ( $orig_matches as $o => $f ) {
            if ( is_numeric( $o ) && is_numeric( $f ) ) {
                $text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) );
                $renderer  = new $this->inline_diff_renderer();
                $diff      = $renderer->render( $text_diff );

                
Home | Imprint | This part of the site doesn't use cookies.