bool array_key_exists ( mixed $key , array $arr )
引數說明:<?php $info = array( 'name' => 'C語言中文網', 'url' => 'http://c.biancheng.net', 'age' => 8, 'desc' => '一個學習程式設計的網站', 'course' => 'PHP教學' ); $key = 'age'; if( array_key_exists($key, $info) ){ //檢測陣列中是否存在該鍵 echo "The'$key'element is in the array 'info'."; } ?>執行結果為:
The'age'element is in the array 'info'.