2
Array
(
[0] => 159042564114859_722842697734840
[1] => 180466813056_10152147419628057
[2] => 201613513237343_622449081153782
)
$post_ids = array('201613513237343_622449081153782', '180466813056_10152147419628057', '159042564114859_722842697734840');
foreach($posts->data as $post)
{
if(array_search($post->id, $post_ids))
{
print '<p>FOUND ' . $post->id . '<p>';
}
}
FOUND 159042564114859_722842697734840
FOUND 180466813056_10152147419628057
出於某種原因,它不檢測所述第三項目陣列中的,與3的201613513237343_622449081153782
此索引,值輸出:
foreach($posts->data as $post)
{
print '<p>post->id: ' . $post->id . '</p>';
}
post->id: 159042564114859_722842697734840
post->id: 180466813056_10152147419628057
post->id: 201613513237343_622449081153782
所以我知道數據在那裏,我在做什麼錯了array_search函數離子?
我見過的,當你不嚴格有關整數和字符串---奇怪它會趕上前兩個這樣奇怪的事情發生,但也許這是值得一試... –
這是在行動:HTTPS ://eval.in/93022 –