Hi i’m new to php and am just wondering how to iterate through an array
$array = ["7","8","8","18","19","20","21","22","8"];
and replace all the values “8” with “1”
i tried
function firstFileInList($array) {
foreach($array as $k => $v)
if(strpos($v, "8") !== false){
return $k;}
}
$testarray[firstFileInList($testarray)] =1;
but it only does the first instance