I am new to php and am trying to write a script that takes a time stamps in the form of "January 23, 2014 at 11:01PM" and breaks them into an array of month, date, year, hour, and minute. Here is my code so far:
$raw_data= array("January 20, 1993 at 10:20PM", "September 6, 1991 at 6:23PM");
var_dump($raw_data);
$num_dates= count($raw_data);
//Step 1: break content into month, day, year, hour, and minutes
for ($i=0; $i==($num_dates-1); $i++) {
$partial_data = implode(preg_split("/[A-Z]{2}/", $raw_data[$i]));
$broken_data[$i] = preg_split("/[\s,:]/", $partial_data);
unset($broken_data[$i][2]);
unset($broken_data[$i][3]);
}
var_dump($broken_data);
The code seems to run fine without the var_dump, but when I add it php tells me that $broken_data is an undefined variable. Anyone see an obvious rookie mistake I'm making?
Thanks in advance.