This function compares the keys of one array with as many as you like. Only the keys of the first array is compared to another or as many as you like. The syntax goes like this:
array_diff_ukey(array1, array2,array3….,fucntion)
Legend:
array1 - is the array to be compared with the other array’s
function - is the name of a user [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
Next in line is array_diff_uassoc() function which compares two or more arrays while checking for differences before comparing the keys with a user-defined location. It then returns an array withthe keys and values from the first array(to which all the values were comapred against) it the function allows it. Syntax is as follows : array_diff_uassoc(array1,array2,array3….,function). [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The next array comparison functions is the array_diff_assoc(array1,array2,array3,array3…..), usage is similar with all of these array_diff functions varying only in the way the comparisons are done. Below is sample code for array_diff_assoc:
Giving you : Array ([0] => Mouse [2] => Dog).
Next we have the array_diff_key() function compares two or more arrays and returns an array [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The first function, array_diff() is used for comparing several tables or arrays which gives an array with the keys and values from the first array if the value is not available in the other arrays. Syntax is as follows : array_diff(array1,array2,array3……), where array 1 is the table to which all the other arrays will be [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The array_count_values() function returns an array which contains the keys of the original array’s value and the value is the number of occurences. A sample of it’s use is shown below:
Which would give us an output of : Array ( [Mouse]=> 1 [Cat]=> 2 [Dog]=> 1 )
The next functions are used to compare the contents [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
This function combines two arrays where the first array is treated as the key and the second array as the contents of the said table. The syntax goes like this : array_combine(array1,array2), wherein the array1 is the table which contains the keys values, and the array2 is the contents. It should be noted that these [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The array_chunk() function on the on the other hand as the name implies, divides an array into chunks or several tables from the source table. The syntax goes something like array_chunk(array,size,preserve_key), wherein the array is the table that would be divided, the size is the number of elements which the new arrays are to contain [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »