What is the purpose of the array_unique() function in PHP?
- To remove duplicate values from an array
- To sort the elements of an array
- To filter the elements of an array
- To merge two arrays into a single array
The array_unique() function in PHP is used to remove duplicate values from an array and return the resulting array. It removes any duplicate values, preserving the keys of the original array. This function is useful when you want to work with unique values in an array. Learn more: http://php.net/manual/en/function.array-unique.php
Loading...
Related Quiz
- To concatenate two strings in PHP, you use the ______ operator.
- A constructor in a PHP class is defined using the __construct() method.
- If a required field is left empty in a PHP form, the form can still be submitted.
- The sort() function in PHP maintains the association between keys and values in an associative array.
- How can you retrieve the value of a specific cookie in PHP?