title: Check in an array where it doesn't contain the value in a foreach loop
body: <p>I am viewing a list of tasks for different projects and the its status.</p>
  
  <p>I have an array which lists out the the different projects i have in the database
  <strong>project_list</strong></p>
  
  <pre><code> Array
      (
          [0] =&gt; Array
              (
                  [project_name] =&gt; test
              )
  
          [1] =&gt; Array
              (
                  [project_name] =&gt; Demo
              )
  
          [2] =&gt; Array
              (
                  [project_name] =&gt; Demo Test
              )
  
      )
  </code></pre>
  
  <p>I have the <strong>task_list</strong> array</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [task_id] =&gt; 1
              [task_name] =&gt; File Upload
              [assigned_to] =&gt; John DOe
              [project_name] =&gt; [{"project_name":"test","status":"Inprogress"},{"project_name":"Demo","status":"Completed"}]
          )
  
      [1] =&gt; Array
          (
              [task_id] =&gt; 2
              [task_name] =&gt; Image Upload
              [assigned_to] =&gt; Jax
              [project_name] =&gt; [{"project_name":"Demo","status":"Completed"}]
          )
  </code></pre>
  
  <p>By looking at the task list you can see a person is assigned to different projects and it shows each project status you can see in project_name field 
  now i want to view the data in a html table list all the projects and then from the task list data from each data it should check the project_name from the project list and put the respective status in its column i have done in the following way but i am not getting the desired result</p>
  
  <pre><code>&lt;thead&gt;
  &lt;tr&gt;
  &lt;th&gt;&lt;i class="fa fa-tasks"&gt;&lt;/i&gt; Task Name &lt;/th&gt;
  &lt;th&gt;&lt;/i&gt; Assigned to &lt;/th&gt;
  &lt;?php 
  foreach ($project_list as $keys =&gt; $val) {
  echo '&lt;th&gt;'.$val['project_name'].'&lt;/th&gt;';
  }
  ?&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;/tbody&gt;
  
  &lt;?php 
  foreach ($task_list as $key =&gt; $value) {?&gt;
  &lt;tr&gt;
  &lt;td&gt; &lt;?php echo $value['task_name']; ?&gt; &lt;/td&gt;
  &lt;td&gt; &lt;?php echo $value['assigned_to']; ?&gt; &lt;/td&gt;
  &lt;?php 
  $obj = json_decode($value['project_name'],true);
  foreach ($project_list as $keys =&gt; $val) {
      foreach ($obj as $row) {
          if($val['project_name']==$row['project_name']){
          echo '&lt;td&gt;'.$val['project_name'].'--'.$row['status'].'&lt;/td&gt;';
  
         // In this phase in facing the problem
          }elseif (!in_array($val['project_name'],$row)) {
          echo "&lt;td&gt;&lt;/td&gt;";
          }
    }
  }
  ?&gt;
  &lt;/tr&gt;
  &lt;?php }?&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>I want to check if from the task list if a project is not list in it, then it should show blank in the table this is the point where i am struggling
  Thanks in advance</p>