I am using the following loop to add items to an an array. I would like to know if it is somehow possible to not add $value to the $liste array if the value is already in the array?
$liste = array();
foreach($something as $value){
array_push($liste, $value);
}
You check if it’s there, using
in_array, before pushing.The
,trueenables “strict checking”. This compares elements using===instead of==.