title: Replace Object inside an Array in php
body: <p>I have one array having multiple objects (say 3 Objects), each having 3 "Key-Value" pairs.</p>
  
  <p><code>$PredefinedResult</code> is something like this :</p>
  
  <pre><code>[
      {
          "EffectiveStatusId":0,
          "EffectiveStatus":"abc",
          "RecordCount":0
      },
      {
          "EffectiveStatusId":0,
          "EffectiveStatus":"def",
          "RecordCount":0
      },
      {
          "EffectiveStatusId":0,
          "EffectiveStatus":"ghi",
          "RecordCount":0
      }
  ]
  </code></pre>
  
  <p>I have another array of objects named <code>$MainResult</code> with values like :</p>
  
  <pre><code>[
      {
          "EffectiveStatusId":1,
          "EffectiveStatus":"abc",
          "RecordCount":7
      },
      {
          "EffectiveStatusId":6,
          "EffectiveStatus":"def",
          "RecordCount":91
      }
  ]
  </code></pre>
  
  <p><strong>Expected Result :</strong></p>
  
  <p>I want to replace the similar objects inside <code>$PredefinedResult</code> with the objects from <code>$MainResult</code> and want result like this :</p>
  
  <pre><code>[
      {
          "EffectiveStatusId":1,
          "EffectiveStatus":"abc",
          "RecordCount":7
      },
      {
          "EffectiveStatusId":6,
          "EffectiveStatus":"def",
          "RecordCount":91
      },
      {
           "EffectiveStatusId":0,
           "EffectiveStatus":"ghi",
           "RecordCount":0
      }
  ]
  </code></pre>
  
  <p><strong>What I tried :</strong></p>
  
  <p>I tried with this code but it's not giving me the desired result.</p>
  
  <pre><code>$FinalResult = array_replace($PredefineResult,$MainResult);
  </code></pre>
  
  <p>Can anyone help me on how to get the Expected Result as mentioned above ?</p>