title: How to check and replace array if array value exists in another multidimensional array
body: <p>I have two arrays and I want to compare array based on <code>day_of_week</code> and <code>status</code> value.</p>
  
  <p>If <code>day_of_week</code> is existing in another array and <code>status</code> is 1 then replace the array with matched array.</p>
  
  <p><strong>$array1</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 4
              [day_of_week] =&gt; sun
              [description] =&gt; sun test description
              [status] =&gt; 0
              [date] =&gt; 2019-01-11
          )
  
      [1] =&gt; Array
          (
              [id] =&gt; 5
              [day_of_week] =&gt; mon
              [description] =&gt; mon test description
              [status] =&gt; 0
              [date] =&gt; 2019-01-11
          )
  )
  </code></pre>
  
  <p><strong>$array2</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 1
              [day_of_week] =&gt; mon
              [description] =&gt; mon updated test description
              [status] =&gt; 1
              [date] =&gt; 2019-01-11
          )
  )
  </code></pre>
  
  <p><strong>Desired Output:</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 4
              [day_of_week] =&gt; sun
              [description] =&gt; sun test description
              [status] =&gt; 0
              [date] =&gt; 2019-01-11
          )
  
      [1] =&gt; Array
          (
              [id] =&gt; 1
              [day_of_week] =&gt; mon
              [description] =&gt; mon updated test description
              [status] =&gt; 1
              [date] =&gt; 2019-01-11
          )
  )
  </code></pre>
  
  <p>I have tried with <code>array_intersect</code> function but not found solution to compare value based on <code>day_of_week</code> and <code>status</code>. Can anyone please help me?</p>
  
  <pre><code>$array = array_intersect($array1, $array2);
  </code></pre>