<?php $names = [ 'John', 'Jane', 'George', 'Jim', 'Jack' ]; $groups = [ '1', '2', '3' ]; foreach ($names as $index => $name) { $result = "The student: " . $name . " belongs to group " .$groups[$index % count($groups)]. ".\n"; echo $result; }
You have javascript disabled. You will not be able to edit any code.