Function Microtime_float () { List ($ usec, $ sec) = explode ("", microtime ()); Return (float) $ usec + (float) $ sec ); } $ Test_arr ['A'] = 'DD '; $ Test_arr ['BB '] = ''; $ Test_arr ['CC'] = NULL; $ Test_arr ['DD'] = false; $ Test_arr = array ('a' => 'DD', 'BB '=> '', 'CC' => null, 'DD' => false ); Echo "isset aa is"; var_dump (isset ($ test_arr ['A']); echo "\ n "; Echo "isset bb is"; var_dump (isset ($ test_arr ['BB']); echo "\ n "; Echo "isset cc is"; var_dump (isset ($ test_arr ['CC']); echo "\ n "; Echo "isset dd is"; var_dump (isset ($ test_arr ['CC']); echo "\ n "; Echo "isset none is"; var_dump (isset ($ test_arr ['none']); echo "\ n "; Echo "key_exist aa is"; var_dump (array_key_exists ('A', $ test_arr); echo "\ n "; Echo "key_exist bb is"; var_dump (array_key_exists ('BB', $ test_arr); echo "\ n "; Echo "key_exist cc is"; var_dump (array_key_exists ('CC', $ test_arr); echo "\ n "; Echo "key_exist dd is"; var_dump (array_key_exists ('DD', $ test_arr); echo "\ n "; Echo "key_exist none is"; var_dump (array_key_exists ('none', $ test_arr); echo "\ n "; $ Time_start = microtime_float (); For ($ I = 0; I I <100; $ I ++ ){ Isset ($ test_arr ['A']); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "isset 100 is $ time \ n "; For ($ I = 0; I I <10000; $ I ++ ){ Isset ($ test_arr ['A']); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "isset 10000 is $ time \ n "; For ($ I = 0; I I <1000000; $ I ++ ){ Isset ($ test_arr ['A']); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "isset 1000000 is $ time \ n "; // ++ $ Time_start = microtime_float (); For ($ I = 0; I I <100; $ I ++ ){ Array_key_exists ('A', $ test_arr ); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "array_key_exists 100 is $ time \ n "; For ($ I = 0; I I <10000; $ I ++ ){ Array_key_exists ('A', $ test_arr ); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "array_key_exists 10000 is $ time \ n "; For ($ I = 0; I I <1000000; $ I ++ ){ Array_key_exists ('A', $ test_arr ); } $ Time_end = microtime_float (); $ Time = $ time_end-$ time_start; Echo "array_key_exists 1000000 is $ time \ n "; |