Greeting From Juz-IT_i

PHP note

print_r - print the function


Array Fuction

array_chunk(array_name, size to be shown in a row, true/false (to show the original index))

array_combine(array1 (to display index), array2 (to display value))

array_count_value(array) - to display the quantity of repetitive element in an array

array_diff(array1,array2,array3) - to display index and value in the first array not found in second and third, and third array is optional

array_diff_assoc(array1, array-n) - comparing value only, will display all the index and value is the value is found in all compared array

array_diff_key(array1, array2, array3) - SAB, but comparing index

array_fill(start_index, number of iteration, value (what to be entered)) - just like insert function

array_filter(array1, "myfunction") - sort the array according to the function predefined

array_flip(array1) - to revert the position of index and value

array_intersect(array1, array-n) - to show all the value from array one that present at all array

array_intersect_assoc(array1, array-n) - SAB, with index and value is the same

array intersect_key(array1, array-n) - comparing index only without concerning the value associated

array_key_exist("intended search key", array)

array_keys(array1, "intended search value") - if intended search value is leave blank then it will return default key 0,1,2,3,4,5...

array_map("myfunction", array1, array-n) to compare the value of array1 with the predefined function, if null is entered, all result will be shown

array_merge(array1, array-n) - to append the array, index will follow the array1, else just append one array, it will start from zero, (IF FOUND SAME INDEX, IT WILL OVERRIDE THE EXISTING VALUE)

array_merge_recursive(array1, array-n) - to append the array and a nested array will be created if the index is the same

array_multisort(array1, SORT_ASC/SORT_DESC, SORT_REGULAR/SORT_NUMERIC/SORT_STRING, array2...)

array_pad(array, size, value) - array padding, if the size is negative, then it will add value before the default value, else it will append

array_pop(array1) - delete the last element

array_product(array1) - product all the numerical value available in array

array_push(array1, value1, value-n) - append element to array

array_rand(array1, number (you of random key u need))

array_reduce(array1, myfucntion, initial) - to perform mathematical process based from the value taken from array, initial is the initial number

array_reverse(array1, TRUE/FALSE) - reverse the whole array

array_search(value, array, TRUE/FALSE) - search the value inside the array

array_shift(array1) - remove the first value of the array

array_slice(array1, start, length, preserve) - if it is negative in start then it will start slicing from zero til the length

array_splice(array1, start, length, array2) - it will replace with the element cutted out from the starting location and the length define how many to insert, if it is zero, it will insert all available in array2

array_sum(array1)





Bitwise Operator

$a << $b (multiply by $b*2)

$a >> $b (divide by $b*2)

&*a - "&" act as a reference link









Question:

1. What is

array_diff_unassoc(array1, array-n, "myfunction")

array_diff_ukey(array1, array-n, "myfunction")

array_intersect_uassoc(array1, array-n, "myfunction")

array_intersect_ukey(array1,array-n, "myfunction")

array_search(value, array, TRUE/FALSE) - TRUE (im not sure how it function)


2. Is there any diff between assoc?



This is my job for the whole day from 9 to 6, hahaha it's just like study for exam!

To be frank it's kinda not nice to sit in front of PC for such a long hours, I just hope that it will ends faster and assign me more off site task?

0 comments: