Function __global->diff_simple_text

Definitions

sources/diff.php

  • Create a diff between two strings.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$old_contents string No No required parameter N/A N/A First string
$new_contents string No No required parameter N/A N/A Second string
$unified boolean No No False N/A N/A Whether to show a unified diff
$include_unchanged boolean No No True N/A N/A Whether to include unchanged lines and trailing whitespace

Returns

  • Diff
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Create a diff between two strings.
 *
 * @param  string $old_contents First string
 * @param  string $new_contents Second string
 * @param  boolean $unified Whether to show a unified diff
 * @param  boolean $include_unchanged Whether to include unchanged lines and trailing whitespace
 * @return string Diff
 */

function diff_simple_text(string $old_contents, string $new_contents, bool $unified = false, bool $include_unchanged = true) : string