I'm trying to display 2 arrays with a foreach loop, but for some reason when the values in the arrays are set to 0, only the last item of the array is displaying
Say I have the following array values:
users array ( 0 => user1, 1 => user2)
occurrences array ( 0 => 0, 1 => 3) //the key represents the user from the users array
The output of the foreach loop will display correctly
//output
user1 0
user2 3
However, if both values are 0 only user2 will be displayed
users array ( 0 => user1, 1 => user2)
occurrences array ( 0 => 0, 1 => 0); //the key represents the user from the users array
//output (should also display user1 0)
user2 0
This is my foreach loop.
?>
<table>
<th>User</th><th># of Occurrences</th>
<?
foreach (array_combine($occurrences, $users) as $occur => $user){
?>
<tr><td><? echo $user; ?></td><td><? echo $occur; ?></td></tr>
<?
}
?></table>
<?