php - array_unique not giving the correct output -


this give results

array( [0] => 5000 [1] => 5001 [2] => 3000 [3] => 3001 [4] => 5000 )

when use array_unique same result obtained

array ( [0] => 5000 [1] => 5001 [2] => 3000 [3] => 3001 [4] => 5000 )

foreach($detail $key => $value){             array_push($zips, $value);               }    }  array_unique($zips); 

array_unique() not work reference. means, won't modify original array, return new array respective modifications. need save output new (or same) variable:

foreach($detail $key => $value){     array_push($zips, $value);   }     $zips = array_unique($zips); 

read more passing reference


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -