PHP: How to check if an entry exists in API?
<p>I am querying the Wikipedia API. Normally I get the following, and I echo out the extract.</p>

<pre><code>array:4 [▼
"pageid" =&gt; 13275
"ns" =&gt; 0
"title" =&gt; "Hungary"
"extract" =&gt; """
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;\n
&lt;p&gt;&lt;b&gt;Hungary&lt;/b&gt; (&lt;span&gt;&lt;span&gt;/&lt;span&gt;&lt;span title="/ˈ/ primary stress follows"&gt;ˈ&lt;/span&gt;&lt;span title="'h' in 'hi'"&gt;h&lt;/span&gt;&lt;span title="/ʌ/ short 'u' in 'bud'"&gt;ʌ&lt;/span&gt;&lt;span title="/ŋ/ 'ng' in 'sing'"&gt;ŋ&lt;/span&gt;&lt;span title="'g' in 'guy'"&gt;ɡ&lt;/span&gt;&lt;span title="/ər/ 'er' in 'finger'"&gt;ər&lt;/span&gt;&lt;span title="/i/ 'y' in 'happy'"&gt;i&lt;/span&gt;&lt;/span&gt;/&lt;/span&gt;&lt;/span&gt;; Hungarian: &lt;span lang="hu"&gt;&lt;i&gt;Magyarország&lt;/i&gt;&lt;/span&gt; &lt;span title="Representation in the International Phonetic Alphabet (IPA)"&gt;[ˈmɒɟɒrorsaːɡ]&lt;/span&gt;) is a parliamentary constitutional republic in Central Europe. It is situated in the Carpathian Basin and is bordered by Slovakia to the north, Romania to the east, Serbia to the south, Croatia to the southwest, Slovenia to the west, Austria to the northwest, and Ukraine to the northeast. The country's capital and largest city is Budapest. Hungary is a member of the European Union, NATO, the OECD, the Visegrád Group, and the Schengen Area. The official language is Hungarian, which is the most widely spoken non-Indo-European language in Europe.&lt;/p&gt;\n
</code></pre>

<p>But if the entry does not exist in Wiki then I get this.</p>

<pre><code>array:3 [▼
"ns" =&gt; 0
"title" =&gt; "Kisfelegyhaza"
"missing" =&gt; ""
]
</code></pre>

<p>So my question is how do I check if <strong>extract</strong> exists?</p>

<p>I tried the following but it does not work.</p>

<pre><code>$wiki_array = The data received from Wiki
if (array_key_exists('extract',$wiki_array)){
 // do something
}
</code></pre>