Skip to content

Diff

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Diff
Since
3.6.0

Diff helper

View source

Public Methods

MethodDescription
compare()Compares two arrays and returns whether they are identical.
diff()Generates a diff for two values, represented as YAML.

compare()

Since
3.6.0

Compares two arrays and returns whether they are identical.

If the values are both arrays, they will be compared recursively.

View source

Arguments

  • $a (mixed)
  • $b (mixed)
  • $strict (boolean) – Whether strict comparisons should be used

Returns

boolean

diff()

Generates a diff for two values, represented as YAML.

View source

Arguments

  • $from (mixed)
  • $to (mixed)
  • $indent (integer) – The indent size that nested values should have
  • $contextLines (integer) – The number of lines to show before and after changes

Returns

string