title: Checking if the array in foreach loop is empty or not
body: <p>I am trying to check if my array is empty or not but strangely I can't get it working.</p>
  
  <pre><code>foreach ($friend as $key =&gt; $id){
  
      $friendActivity = $db-&gt;friendActivity($id);
  
      if (!empty($friendActivity)) {
  
          //rest of the code
  
      }
  
  }
  </code></pre>
  
  <p>I have used <strong>var_dump($friendActivity)</strong> before the <strong><em>if statement</em></strong> and the result is as follow:</p>
  
  <pre><code>array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { }  
  </code></pre>
  
  <p>//////---> Something to know &lt;--------/////////</p>
  
  <p>I am not trying to see the count of arrays. Each user in database has some activities. I want to see if those activities match with the (poll of of activities). So if the user has mentioned about their activities, therefore the $friendActivity is not going to be empty.</p>
  
  <p>If I use empty:</p>
  
  <pre><code>if (empty($friendActivity)){
  
      //rest of the code
  
  }
  </code></pre>
  
  <p>I am able to get inside the if condition...</p>
  
  <p>I personally think, that I have to delete the array at the end of each foreach loop, so that I don't store the other user's friends activities.</p>