如何在php中实现循环[关闭]

Hi I'm totally new here and with and would glad if someone could help as I'm stuck with how I can create a loop with some php code.

$TotalUniques = $this->TotalUniquesHits($Counts[$xx]['ID']);

The value I'm after is [$xx] which represents a position in the array. How to change it so that I get $TotalUniques looping through all the values of $xx?

You can try with foreach loop:

foreach($Counts as $xx){ 
    $TotalUniques[] = $this->TotalUniquesHits($xx['ID']);
}

You may also consider checking if each $xx has ID key with isset or array_key_exists.