Archive for February, 2008

Array_diff Function

Tuesday, February 26th, 2008

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 ...

Array Count Values

Thursday, February 21st, 2008

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 ...

Array Combine

Saturday, February 16th, 2008

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 ...

Array Chunk Function

Monday, February 11th, 2008

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 ...

Arrays : Changing cases

Wednesday, February 6th, 2008

This form of array declaration allows one to change the case from uppercase to lowercase and vice versa. The syntax goes as follows: array_change_key_case(array,case) The array part, specifies which table or array to use and is a required field which is not the case with the key which is automatically assigned a ...