COMPARE
NAME
compare - Compare 2 objects recursively.
SYNOPSIS
compare(object1, object1[, respect_type:bool]);
DESCRIPTION
This function is used to compare 2 objects resurcively with or without type checking.
PARAMETERS
- respect_type
- If respect_type is true, it will make sure all objects are of the same type( for example : "12" and 12 is not ok with respect = true)
RETURN
- true if both object are identical, false otherwise
EXAMPLES
compare(
{ "a" : [1,2,{ "a" : [1,2,3], "b" : 2, "c" : 3}], "b" : 2, "c" : 3},
{ "b" : 2, "c" : 3, "a" : [1,2,{ "a" : [1,2,3], "b" : 2, "c" : 3}]}
); // return true
compare([1,2,3],[1,2,3]); // return true
compare(5,"5"); // return true
compare(5,"5",respect_type:true); // return false
SEE ALSO
AUTHOR
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2021-10-10 21:24:14 laplante@sednove.com implement in version 5.165
Edit