title: Check key's array with value's array and set it as value
body: <p>I have a question for you.
  My PHP code is composed by these below arrays and my intention is to merge them into one, as you can see at the bottom of the topic.
  These arrays are divided into 2 different variables: $array1 and $array2.</p>
  
  <pre><code>Array ($array1)
  (
      [0] =&gt; 2016-11-11
      [1] =&gt; 2016-11-10
      [2] =&gt; 2016-11-09
      [3] =&gt; 2016-11-08
      [4] =&gt; 2016-11-07
      [5] =&gt; 2016-11-06
      [6] =&gt; 2016-11-05
  )
  1
  Array ($array2)
  (
      [2016-11-11] =&gt; 0
      [2016-11-10] =&gt; 0
      [2016-11-08] =&gt; 0
      [2016-11-07] =&gt; 0
      [2016-11-06] =&gt; 0
  )
  1
  </code></pre>
  
  <p>And this is what I expect this program will do:</p>
  
  <pre><code>Array
  (
      [2016-11-11] =&gt; 0,
      [2016-11-10] =&gt; 0,
      [2016-11-09] =&gt; NULL,
      [2016-11-08] =&gt; 0,
      [2016-11-07] =&gt; 0,
      [2016-11-06] =&gt; 0,
      [2016-11-05] =&gt; NULL
  )
  1
  </code></pre>
  
  <p>How can I set my code so that it returns me the previous array? How can I solve this problem? Can anyone help me?</p>
  
  <p>I tried:</p>
  
  <pre><code>$array1 = array( 
      "2016-11-11", 
      "2016-11-10", 
      "2016-11-09", 
      "2016-11-08",
      "2016-11-07",
      "2016-11-06",
      "2016-11-05"
  );
  $array2 = array();
  while($row1 = $result1-&gt;fetch_assoc())
  {
      $array2[$row1["datesend"]] = $row1["error"];
  }
  </code></pre>