Answers for "php array sum duplicate values"

PHP
1

remove duplicate values in array php

<?php
$list_programming_language = array('C#',  'C++', 'PHP', 'C#', 'PHP');
$result = array_unique($list_programming_language);
print_r($result);
?>
  
// ==> 'C#',  'C++', 'PHP'
Posted by: Guest on March-11-2021
0

php array_push in foreach duplicate

foreach($something as $value){
    if(!in_array($value, $liste, true)){
        array_push($liste, $value);
    }
}
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language