Answers for "add to array php keep duplicates"

PHP
0

php combine 2 arrays keep duplicates

$arrKeys = array('str', 'str', 'otherStr');
$arrVals = array('1.22', '1.99', '5.17');
function foo($key, $val) {
   return array($key=>$val);
}

$arrResult = array_map('foo', $arrKeys, $arrVals);
Posted by: Guest on August-17-2020
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

Code answers related to "add to array php keep duplicates"

Browse Popular Code Answers by Language