EWS управлял API, чтобы проверить, существует ли событие в учетной записи пользователя или нет

Это хорошо документированное поведение PHP. См. предупреждение на странице foreach php.net

Warning

Ссылка на $ value , а последний элемент массива остается даже после цикла foreach . Рекомендуется уничтожить его unset ().

blockquote>
$a = array('a', 'b', 'c', 'd');

foreach ($a as &$v) { }
unset($v);
foreach ($a as $v) { }

print_r($a);

EDIT

Попытайтесь пошаговое руководство к тому, что на самом деле происходит здесь

$a = array('a', 'b', 'c', 'd');
foreach ($a as &$v) { }   // 1st iteration $v is a reference to $a[0] ('a')
foreach ($a as &$v) { }   // 2nd iteration $v is a reference to $a[1] ('b')
foreach ($a as &$v) { }   // 3rd iteration $v is a reference to $a[2] ('c')
foreach ($a as &$v) { }   // 4th iteration $v is a reference to $a[3] ('d')

                          // At the end of the foreach loop,
                          //    $v is still a reference to $a[3] ('d')

foreach ($a as $v) { }    // 1st iteration $v (still a reference to $a[3]) 
                          //    is set to a value of $a[0] ('a').
                          //    Because it is a reference to $a[3], 
                          //    it sets $a[3] to 'a'.
foreach ($a as $v) { }    // 2nd iteration $v (still a reference to $a[3]) 
                          //    is set to a value of $a[1] ('b').
                          //    Because it is a reference to $a[3], 
                          //    it sets $a[3] to 'b'.
foreach ($a as $v) { }    // 3rd iteration $v (still a reference to $a[3]) 
                          //    is set to a value of $a[2] ('c').
                          //    Because it is a reference to $a[3], 
                          //    it sets $a[3] to 'c'.
foreach ($a as $v) { }    // 4th iteration $v (still a reference to $a[3]) 
                          //    is set to a value of $a[3] ('c' since 
                          //       the last iteration).
                          //    Because it is a reference to $a[3], 
                          //    it sets $a[3] to 'c'.

0
задан Kartik Thakurela 18 January 2019 в 06:00
поделиться

1 ответ

Как правило, вы всегда хотите использовать CalendarView при просмотре встреч, потому что это расширяет повторяющиеся встречи. Вы не можете использовать фильтры с CalenderView, поэтому, хотя это может быть не так эффективно, как вам нравится, просто поиск и синхронизация за период времени, как правило, лучший подход и использование свойства GOID https://docs.microsoft.com/ en-us / office / client-developer / outlook / mapi / pidlidglobalobjectid-canonical-property в качестве идентификатора.

0
ответ дан Glen Scales 18 January 2019 в 06:00
поделиться
Другие вопросы по тегам:

Похожие вопросы: