PHP array_diff_assoc() Function6 Jan 2025 | 1 min read The array_diff_assoc() function is used to compare an array against another array and returns the difference. In other words, we can say that array_diff_assoc() function compares the keys and values of two or more arrays and return an array that contains the entries from array1 that are not present in array2 or array3. This function was introduced in PHP 4.3. Syntax
Return TypeReturns an array containing all the values from array1 that are not present in any of the other arrays. Example 1Output: Array ( [2] => green [3] => blue [4] => black ) Example 2Output: Array ( [b] => mango ) Example 3Output: Array ( [a] => orange [b] => mango [c] => banana ) Example 4Output: Array( [3]=> Array ( [4] => black ) ) Next TopicPhp-array-diff-function |
PHP list() Function The PHP list( ) function is used to assign values to a list of variables in one operation. This function was introduced in PHP 4.0. Syntax array list ( mixed $var1 [, mixed $... ] ); Parameter Parameter Description Is compulsory Variable1 The first variable to assign a value to. compulsory Variable2... More variables...
1 min read
PHP sort() Function The PHP sort( ) function is used to sort the array elements in ascending order. This function was introduced in PHP 4.0. Syntax bool sort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array to be sorted. compulsory Sort flags Sorting behavior. Possible type : SORT_REGULAR...
1 min read
PHP natsort() Function The PHP natsort( ) function is used to sort an array using a "natural order" algorithm. The natsort( ) function implements a sort algorithm but maintains original keys and values. This function was introduced in PHP 4.0. Syntax bool natsort ( array &$array ); Parameter Parameter Description Is compulsory array Specifies...
2 min read
The array_pad() function is a built-in function of PHP. The array_pad() function inserts a specified number of elements, with a specified value, to an array. This function was introduced in PHP 4.0. Syntax array array_pad ( array $array , int $size , mixed $value ); Parameters Parameter Description Required/Optional array Specifies an array. compulsory size Specifies...
1 min read
PHP uksort() Function The PHP uksort( ) function is used to sort an array by the elements keys using a user-defined comparison function. This function was introduced in PHP 4.0. Syntax bool uksort ( array &$array , callable $key_compare_func ); Parameter Parameter Description Is compulsory array Specifies the array to be sorted. compulsory user_defined_function This function is...
2 min read
This is an inbuilt function of PHP. This function was introduced in PHP 5.1. The array_diff_key() function compares the keys of two or more arrays, and returns entries from array1 that are not present in array2 or array3, etc. Syntax array_diff_key(array1,array2,array3...); Parameter Description Is compulsory array1 The array to compare from compulsory array2 An array...
1 min read
PHP ksort() Function The PHP ksort() sorts an associative array in ascending order, according to the key. It is mainly used for an associative array. This function was introduced in PHP 4.0. Syntax bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] ); Parameter Parameter Description Is compulsory array Specifies the array...
1 min read
PHP array diff_ukey() Function The array_diff_ukey() is an inbuilt function in PHP. The array_diff_ukey() function compares the keys of two or more arrays with a user-defined function, and returns an array that contains the entries from array1 that are not present in array2 or array3, etc. This...
2 min read
PHP current() Function The current( ) function is an inbuilt function of PHP, and it is used to return the value of the current element in an array. This function was introduced in PHP 4.0. Syntax mixed current ( array $array ); Parameters Parameter Description Is compulsory array Specifies the array to use. compulsory Return Values The...
1 min read
The array_uintersect() is an inbuilt function in PHP. It is used to compute the intersection of two or more arrays depending on the values. The first array values are compared with all the other arrays with the help of an user-defined function, and the matches...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India