Great answers are already present above, but if you have multiple array_push() all over your code, it would be a pain to write if(in_array()) statements every time.
Here's a solution that will shorten your code for that case:
Use a separate function.
function arr_inserter($arr,$add){ //to prevent duplicate when inserting
if(!in_array($add,$arr))
array_push($arr,$add);
return $arr;
}
Then in all your array_push() needs, you can call that function above, like this:
$liste = array();
foreach($something as $value){
$liste = arr_inserter($liste, $value);
}
If $value is already present, $liste remains untouched.
If $value is not yet present, it is added to $liste.
Hope that helps.