If this is my code how would I loop to the next dog of the current owner after the dog has been fed 3 times.

Foreach ($owners as $owner) {
    For($x=1;$x<=$NumOfDogs;$x++) {
        $dog = $dogs[$x];
        shuffle($dogFoods);
        Foreach ($dogFoods as $dogFood) {
            For($y=1;$y<3;$y++) {
                Feed($dog, $dogFood);
            }
        }
    }
}

Shouldn't NumOfDogs be $NumOfDogs?

Or are you trying to call a function NumOfDogs()?

yea i edited it. Supposed to be $NumofDogs which would be a count($dogs)

I think you just need to stick in another Foreach loop. Something like:

Foreach ($owners as $owner) {
    Foreach($dog as $ownersdogs) {
        $dog = $owner.$dogs[$x]; //my PHP syntax knowledge isn't great, so this may be wrong :D
        shuffle($dogFoods);
        Foreach ($dogFoods as $dogFood) {
            For($y=1;$y<3;$y++) {
                Feed($dog, $dogFood);
            }
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.