以下の配列では、配列にキー[year]
が存在するかどうかをチェックしたいと思います。あなたが見ることができるように、配列1と2には[year]
がありません。配列内にあるかどうかを確認するには[year]
かどうか基本的にそれが存在する場合は、別のものを実行して別のものを実行してください。 ==============================多次元配列にキーが存在するかどうかをチェック
isset($custom_array[0]['year']);
:
Array
(
[0] => Array
(
[filmId] => 61359
[url] => http://www.moviemeter.nl/film/61359
[title] => Unstoppable
[alternative_title] =>
[year] => 2011
[thumbnail] => http://www.moviemeter.nl/images/covers/thumbs/61000/61359.jpg
[average] => 0
[votes_count] => 0
[similarity] => 100.00
[directors_text] => geregisseerd door Richard Harrison
[actors_text] => met Chen Shilony, Ruben Crow en David Powell
[genres_text] => Drama/Komedie
[duration] => 90
)
[1] => Array
(
[filmId] => 87923
[url] => http://www.moviemeter.nl/film/87923
[title] => Unstoppable
[alternative_title] =>
[thumbnail] => http://www.moviemeter.nl/images/covers/thumbs/87000/87923.jpg
[average] => 0
[votes_count] => 0
[similarity] => 100.00
[directors_text] => geregisseerd door Example Director
[actors_text] => met Actor 1, Actor 2 en Actor 3
[genres_text] => Drama/Komedie
[duration] => 90
)
[2] => Array
(
[filmId] => 68593
[url] => http://www.moviemeter.nl/film/68593
[title] => Unstoppable
[alternative_title] =>
[thumbnail] => http://www.moviemeter.nl/images/covers/thumbs/68000/68593.jpg
[average] => 3.3
[votes_count] => 191
[similarity] => 100.00
[directors_text] => geregisseerd door Tony Scott
[actors_text] => met Denzel Washington, Chris Pine en Rosario Dawson
[genres_text] => Actie/Thriller
[duration] => 98
)
[3] => Array
(
[filmId] => 17931
[url] => http://www.moviemeter.nl/film/17931
[title] => Unstoppable
[alternative_title] => Nine Lives
[year] => 2004
[thumbnail] => http://www.moviemeter.nl/images/covers/thumbs/17000/17931.jpg
[average] => 2.64
[votes_count] => 237
[similarity] => 100.00
[directors_text] => geregisseerd door David Carson
[actors_text] => met Wesley Snipes, Jacqueline Obradors en Mark Sheppard
[genres_text] => Actie/Thriller
[duration] => 96
)
)
[array_key_exists()](http://ca3.php.net/manual/en/function.array-key-exists.php) – Augwa