title: using if() in php to see if date in array is equal to date stored in variable
body: <p>I have the following code in my index.php:</p>
  
  <pre><code>$d1 = date('Y-m-d', strtotime("-4 days"));
  $newrecord = [];
    for($i = 1; $i &lt;= sizeof($methods); $i++) {
        $keys = ["Email", "FirstName", "LastName"];
        $newrecord[$i][0] = $methods[$i][1];
        $newrecord[$i][1] = $methods[$i][2];
        $newrecord[$i][2] = $methods[$i][3];
        $newrecord[$i][3] = explode(" ", $methods[$i][6]);
        $newrecord[$i][3] = $newrecord[$i][3][0];
  
        $newrecord[$i][4] = $d1;
        if ($newrecord[$i][3] == $newrecord[$i][4]){
          $newrecord[$i][5] = "New Entry";
        }
  }
  </code></pre>
  
  <p>I am expecting to loop through my entire <code>$methods</code> array, and after assigning new values to each of my <code>$newrecord[$i]</code> entries, I need to check whether the value of <code>$newrecord[$i][3]</code> equals the date of 4 days ago.</p>
  
  <p>The problem is that it doesn't look like the <code>if()</code> check is successful, because none of my arrays contain the <code>[5] =&gt; "New Entry"</code> array component.</p>
  
  <p>However, I know that there are 120 instances in the array when these do equal each other. For instance:</p>
  
  <blockquote>
    <p>[23] => Array ( [3] => 2018-07-15 [4] => 2018-07-15 [Email] =>
    me@example.com [FirstName] => John [LastName] => Doe )</p>
  </blockquote>
  
  <p>Returns for record <code>[23]</code> when I print the output of all the arrays, and there are 120 of them that are like this in total (out of around 8000).</p>
  
  <p>This same thing happens when i just put <code>if($newrecord[$i][3] == $d1)</code> in the if statement.</p>
  
  <p>Any advice on what I'm missing? I appreciate the help.</p>
  
  <p>Note: the values for <code>["Email"] ["FirstName"] ["LastName"]</code> occur later in the function, this is just a snippet of it to keep it more concise.</p>