I have the following code in my index.php:
$d1 = date('Y-m-d', strtotime("-4 days"));
$newrecord = [];
for($i = 1; $i <= 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";
}
}
I am expecting to loop through my entire $methods
array, and after assigning new values to each of my $newrecord[$i]
entries, I need to check whether the value of $newrecord[$i][3]
equals the date of 4 days ago.
The problem is that it doesn't look like the if()
check is successful, because none of my arrays contain the [5] => "New Entry"
array component.
However, I know that there are 120 instances in the array when these do equal each other. For instance:
[23] => Array ( [3] => 2018-07-15 [4] => 2018-07-15 [Email] => me@example.com [FirstName] => John [LastName] => Doe )
Returns for record [23]
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).
This same thing happens when i just put if($newrecord[$i][3] == $d1)
in the if statement.
Any advice on what I'm missing? I appreciate the help.
Note: the values for ["Email"] ["FirstName"] ["LastName"]
occur later in the function, this is just a snippet of it to keep it more concise.