array_key_existsの履歴
http://jp2.php.net/manual/ja/function.array-key-exists.php
array_key_existsとisset
$array = array('hoge' => null); var_dump(array_key_exists('hoge', $array)); // true var_dump(isset($array['hoge'])); // false
benchmark
issetの方が3倍ほど早い
$array = array('hoge' => null); require_once('Benchmark/Timer.php'); $b = new Benchmark_Timer(); $b->start(); for($i = 0; $i < 100000; $i++){ array_key_exists('hoge', $array); // true } $b->setMarker(1); for($i = 0; $i < 100000; $i++){ isset($array['hoge']); // false } $b->display(); ---------------------------------------------------- marker time index ex time perct ---------------------------------------------------- Start 1179177790.06100900 - 0.00% ---------------------------------------------------- 1 1179177790.20730100 0.146292 77.16% ---------------------------------------------------- Stop 1179177790.25059300 0.043292 22.84% ---------------------------------------------------- total - 0.189584 100.00% ----------------------------------------------------