Published on : September 01, 2020
Title | : | Array Difference |
Purpose | : | To get a different key and values from arrays |
Syntax | : | [php.array_diff_assoc p1=”{array1}” p2=”{array2}” o.set=template.res /] |
Input Parameter | : | Array1, Array2 |
Return value | : | Returns an array containing the entries from array1 that are not present in any of the other arrays |
Example | : |
[template.set_array x a1=1 a2=2 a3=3 /]
[template.set_array y a4=4 a2=2 a6=6 /]
[php.array_diff_assoc p1=”{template.x}” p2=”{template.y}” o.set=template.res /]
[template.echo res /]
|
Output | : | New array with distinct elements |
Description | : | We can compare the keys and values of two arrays, and return the differences using this function |