I have the following PHP function where I am trying to explode an array and apply foreach loop on it to get a collective set of data. However, I am getting the error quoted in the subject.
function getSwipableUsers() {
  $expInt = explode(',', $f['interests']);
  $userDisplayData = array();
  foreach($expInt as $ints){
    $userDisplayData[] = "<div class='tag alert-primary'>".$ints."</div>";
  }
  $html = '<div class="user-distance mt-2">'.$userDisplayData.'</div>';
  return $html;
}
I rechecked again and again but everything seems fine to me. What's wrong with my code here?
 
    