Found 27759 Articles for Server Side Programming

array_intersect_assoc() function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:23

38 Views

The array_intersect_assoc() function compares array values, and returns the matches. Syntax array_intersect_assoc(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 − Array to compare against. Required. arr3 − You can add more arrays to compare. Optional. arr4 − You can add more arrays to compare. Optional. Return The array_intersect_assoc() function returns an array containing all of the values in the first array whose values exist in all of the parameters. Example Live Demo Output Array ( [p] => headphone [q] => earpod )

array_intersect() function in PHP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

53 Views

The array_intersect() function compares array values, and returns the matches. It returns an array containing all of the values in the first array whose values exist in all of the parameters. Syntax array_intersect(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 − Array to compare against. Required. arr3 − You can add more arrays to compare. Optional. arr4 − You can add more arrays to compare. Optional. Return The array_intersect() function returns an array containing all of the values in the first array whose values exist in all of the ... Read More

array_flip() function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:23

87 Views

The array_flip() function exchanges all keys with their associated values in an array. It returns flipped array on success, else NULL on failure. Syntax array_flip(arr) Parameters arr − Specify the array of key/value pairs to be flipped. Return The array_flip() function returns flipped array on success, else NULL on failure. Example Live Demo Output Array ( [keyboard] => p [mouse] => q [monitor] => r )

array_filter() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:36:12

78 Views

The array_filter() function filters elements of an array using a user-made callback function. It returns the filtered array.Syntaxarray_filter(arr, callback, flag)Parametersarr − The array that will be filteredcallback − The callback function to be usedflag − The parameters sent to the callback function:ARRAY_FILTER_USE_KEY − pass key as the only argument to callback instead of the valueARRAY_FILTER_USE_BOTH − pass both value and key as arguments to callback instead of the valueReturnThe array_filter() function returns the filtered array.Example Live DemoOutputArray ( [1] => 6 [4] => 20 [5] => 30 [7] => 48 [9] => 66 )

array_fill_keys() function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:23

52 Views

The array_fill_keys() function fill an array with values, specifying keys. It returns the filled array. Syntax array_fill_keys(keys, values) Parameters keys − Array of values to be used as keys. values − Values that would be used to fill. Return The array_fill_keys() function returns the filled array. Example Live Demo Output Array ( [p] => demo [q] => demo [r] => demo ) Let us see another example. Example Live Demo Output Array ( [a] => demo [b] => demo [c] => demo [1] => demo [2] => demo [3] => demo [steve] => demo [tom] => demo [4] => demo [5] => demo )

array_fill() function in PHP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

141 Views

The array_fill() function is used to fill an array with values. It returns the filled array. It returns the filled array. Syntax array_fill(start_index, num, value) Parameters start_index − First index of the returned array. Required. num − The count of elements to insert. Required. value − The value that would fill the array. Required. Return The array_fill() function returns the filled array. Example Live Demo Output Array ( [3] => demo [4] => demo [5] => demo [6] => demo [7] => demo )

array_diff_ukey() function in PHP

Samual Sam
Updated on 24-Jun-2020 09:36:59

48 Views

The array_diff_ukey function compares array keys, with an additional user-made function check, and returns the differences.Syntaxarray_diff_ukey(arr1, arr2, arr3, arr4, …, compare_func)Parametersarr1 − Array to compare from. Required.arr2 − Array to compare against. Required.arr3 − You can add more arrays to compare. Optional.arr4 − You can add more arrays to compare. Optional.compare_func − This callback function must return an integer than 0 if the first argument is considered to be respectively than the second.ReturnThe array_diff_ukey() function returns an array containing the entries from the first array that are not present in any of the other arrays.The following is an ... Read More

array_diff_uassoc() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:37:17

35 Views

The array_diff_uassoc() compares array keys and values, with an additional user-made function check, and returns the differences. It returns an array containing the entries from the first array that are not present in any of the other arrays.Syntaxarray_diff_uassoc(arr1, arr2, arr3, arr4, …, compare_func)Parametersarr1 − Array to compare from. Required.arr2 − Array to compare against. Required.arr3 − You can add more arrays to compare. Optional.arr4 − You can add more arrays to compare. Optional.compare_func − This callback function must return an integer than 0 if the first argument is considered to be respectively than the second.ReturnThe array_diff_uassoc() function returns ... Read More

array_diff_key() function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:23

55 Views

The array_diff_key() function compares array keys, and returns the differences. It returns an array containing the entries from the first array that are not present in any of the other arrays. Syntax array_diff_key(arr1, arr2, arr3, arr4, ...) Parameters arr1 − Array to compare from. Required. arr2 − Array to compare against. Required. arr3 − You can add more arrays to compare. Optional. arr4 − You can add more arrays to compare. Optional. Return The array_diff_key() function returns an array containing the entries from the first array that are not present in any of the other arrays. ... Read More

array_diff_assoc() function in PHP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

41 Views

The array_diff_assoc() function compares array keys and values, and returns the differences. The array_diff() function only compares the values, whereas in array_diff_assoc() function both the keys and values are used for comparison. Syntax array_diff_assoc(arr1, arr2, arr3, arr4, …) Parameters arr1 − Array to compare from. Required. arr2 − Array to compare against. Required. arr3 − You can add more arrays to compare. Optional. arr4 − You can add more arrays to compare. Optional. Return The array_diff_assoc() function returns the comparison between both the arrays. It returns an array containing all the values from arr1 that ... Read More

Advertisements