How to remove all duplicate values in array in php?



How to remove all duplicate values in array in php?..

Answer / Priyanka Gupta

You can use the array_unique() function to remove duplicate values from an array, as mentioned earlier.nExample:n```phpn$arr = [1, 2, 3, 4, 5, 3, 6, 7, 8, 5];n$result = array_unique($arr);n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Tell me what is pear?

1 Answers  


Suppose a variable may passed to other page using any of get,post,session,cookie methods and u want to retrive that variable value . what is the syntax?

6 Answers  


Where is the submitted form data stored?

1 Answers  


Write the statements that are used to connect php with mysql

1 Answers  


Tell me what is the main difference between require() and require_once()?

1 Answers  


What are php strings?

1 Answers  


Do you know what is the function func_num_args() used for?

1 Answers  


Why do we use namespace in php?

1 Answers  


List some of the features of php7.

1 Answers  


Please explain is it possible to use com component in php?

1 Answers  


Explain include(), include_once, require() and require_once?

1 Answers  


Difference between $message vs. $$Message in php.

1 Answers  


Categories