PHP array_unique( ) Function6 Jan 2025 | 1 min read The array_unique( ) function is an inbuilt function of PHP and it is used to remove duplicate values from an array. This function was introduced in 4.0.1 SyntaxParameters
ReturnThe array_unique( ) function returns the filtered array. Example 1Output: Array ( [a] => zee [c] =>aajtak [d] =>ndtv ) Example 2Output: Array ( [0] => java [1] =>php [3] => python [4] => html ) Example 3Output: Array ( [a] =>abhijeet [b] =>arijit ) Example 4Output: Array ( [a] => dell [0] =>hp [1] =>leneovo ) Next TopicPhp-array-unshift-function |
The array_key_exists( ) is an builtin function of PHP. The array_key_exists( ) function checks an array for a specified key, and returns true if the key exists and false if the key does not exists. This function was introduced in PHP 4.0.7. Syntax array_key_exists(key,array); Parameter Description Is compulsory key Specifies the key. compulsory array Specifies...
1 min read
The array_reverse() function is a inbuilt function of PHP. The array_reverse( ) function is used to reverse the order of the elements in an array. This function was introduced in PHP 4.0. Syntax array array_reverse ( array $array [, bool $preserve_keys = FALSE ] ); Parameter Parameter Description Is compulsory array Specifies an...
1 min read
The compact( ) function is an inbuilt function of PHP, and it is used to create an array from variables and their values. This function was introduced in PHP 4+. Syntax array compact ( mixed $varname1 [, mixed $... ] ); Parameters Parameter Description Is compulsory Variable1 It can be either a string...
1 min read
This function is used to flip the array with the keys and values. It takes one parameter that is an array. The returned array will contain the flipped elements. The values will be the keys, and the keys will be the values. This function was...
1 min read
The array_intersect_ukey( ) function Computes the intersection of arrays using a callback function on the keys for comparison. The function returns an array containing all the values of the first array which have matching keys that are present in all the arguments. This function was...
1 min read
This function is inbuilt in PHP and it was introduced in PHP 5. The function array_diff_uassoc() is used to compute the difference of arrays with additional index check which is performed by a user supplied callback function. In simple words, the function compares array1 against array2...
1 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
PHP array_count_values() Function The array_count_values() function returns an array where the keys are the original array's values, and the values is the number of occurrences. In other words, we can say that array_count_values() function is used to calculate the frequency of all of the elements of...
1 min read
The array_merge( ) function is a built-in function of PHP. This function is used to merge the elements or values of two or more arrays together into a single array. This function was introduced in PHP 4.0. Syntax array array_merge(array $array1[, array $...]); Parameter Parameter Description Is compulsory array1 Specifies an array. compulsory array2 Specifies an...
1 min read
The array_multisort() is an built-in function in PHP. This function is used to sort multiple arrays at once or a multi-dimensional array with each dimension. This function was introduced in PHP 4.0. Syntax bool array_multisort ( array &$array1 [, mixed $array1_sort_order = SORT_ASC [, mixed$array1_sort_flags = SORT_REGULAR...
2 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