Array unique problem using php?
-
Hi,Dear Frnd...........I Hope u r all fine. I am using php array_unique function.Here is the problem in this function. This is the code. --------------------------------------… <?php $frnd1 = array( 0=> 'arfan', 1=> 'haider', 2=> array( 0=> 'azeem', 1=> 'jeme', ), 3=> array( 0=> 'haider', 1=> 'one' ) ); // please do not change the above code. // You can only change below code. print_r($frnd1); echo '<hr />'; print_r(array_unique($frnd1)); ?> --------------------------------------… This work fine,But when I am used array_unique then it does not work. When I am used array_unique.It ignore the [3]=>Array. As you can see in my array,Here is two time name "haider". I want to do that in this array all same names are convert into one unique name. In this array I want to ignore the "haider" name bcs it is two time.How can I do that. Remmber :: This example is very simple.Bcs u can understand it easily.Suppose if it is dynamically changed array then what i did do to make it unique. ......................................…
-
Answer:
The problem with using array_unique() on multi-dimensional arrays is that it will not go through the sub arrays. Google 'php array unique recursive' for multiple options to solve this issue. Cheers, Gitlez
Arafn Haider at Yahoo! Answers Visit the source
Related Q & A:
- How To Build Business Directory Using Php Mysql?Best solution by Stack Overflow
- How to pass javascript jQuery variable value in php array?Best solution by Stack Overflow
- how delete node in xml file using php?Best solution by Stack Overflow
- How to read csv file using php?Best solution by Stack Overflow
- How to generate unique codes in PHP?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.