I am trying to manipulate some data coming in the object, but being unsuccessful. I have tried $endNotices[0]->hours $endNotices[0]->{"hours"} and much more.
I am mainly trying to extract the 'seriesId' data in the following:
Array
(
[0] => ReminderNotice Object
(
[seriesId:ReminderNotice:private] => 338
I am trying to grab only the number 338.
Below is the code I am using to write the data to the file:
$endNotices = $repository->GetReminderNotices(Date::Now(), ReservationReminderType::End);
Log::Debug('Found %s end reminders', count($endNotices));
$my_file = 'file.txt';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
//$data = print_r($endNotices, true);
fwrite($handle, print_r($endNotices[0], true));
foreach ($endNotices as $notice)
{
ServiceLocator::GetEmailService()->Send(new ReminderEndEmail($notice));
}
The result being printed to the file is:
Array
(
[0] => ReminderNotice Object
(
[seriesId:ReminderNotice:private] => 338
[reservationId:ReminderNotice:private] => 328
[referenceNumber:ReminderNotice:private] => 5745cc5bbee9b783620114
[startDate:ReminderNotice:private] => Date Object
(
[date:Date:private] => DateTime Object
(
[date] => 2016-05-25 05:00:00
[timezone_type] => 3
[timezone] => UTC
)
[parts:Date:private] => Array
(
[hours] => 05
[minutes] => 00
[seconds] => 00
[mon] => 05
[mday] => 25
[year] => 2016
[wday] => 3
)
[timezone:Date:private] => UTC
[timestring:Date:private] => 2016-05-25 05:00:00
[timestamp:Date:private] => 1464152400
)
[endDate:ReminderNotice:private] => Date Object
(
[date:Date:private] => DateTime Object
(
[date] => 2016-05-25 19:00:00
[timezone_type] => 3
[timezone] => UTC
)
[parts:Date:private] => Array
(
[hours] => 19
[minutes] => 00
[seconds] => 00
[mon] => 05
[mday] => 25
[year] => 2016
[wday] => 3
)
[timezone:Date:private] => UTC
[timestring:Date:private] => 2016-05-25 19:00:00
[timestamp:Date:private] => 1464202800
)
[title:ReminderNotice:private] =>
[description:ReminderNotice:private] =>
[resourceName:ReminderNotice:private] => TEST-RESOURCE
[emailAddress:ReminderNotice:private] => dansmith@gmail.com
[firstName:ReminderNotice:private] => Dan
[lastName:ReminderNotice:private] => Smith
[timezone:ReminderNotice:private] => America/Chicago
[reminder_minutes:ReminderNotice:private] =>
[language:ReminderNotice:private] => en_us
)
)
This is exactly what I want, but printing the variable
Aucun commentaire:
Enregistrer un commentaire