Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

remove duplicates in array

$
0
0

I have an array called $lineArray.

 

If I do a var_dump on $lineArray[5] I will get a few hundreds entries, something like:

 

string(9) "something"

string(13) "somethingelse"

string(9) "notreally"

string(9) "something"

 

I need to move/copy all those lines into another array but without the duplicates, so I will only have one 'something' in the new array, not have it twice as per the above example.

 

I've tried:

 

    $pagesWithErrors = array();
    $pagesWithErrors[] = $lineArray[5];
    $pagesWithErrors = array_unique($pagesWithErrors);
 
But it doesn't work for me.
 
How do I do it?

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles