function Microtime_float () { List ($usec, $sec) = Explode ("", Microtime ()); return (float) $usec + (float) $sec); } $test _arr[' AA ']= ' DD '; $test _arr[' BB ']= '; $test _arr[' cc ']=null; $test _arr[' DD ']=false; $test _arr= Array (' AA ' = ' dd ', ' bb ' = ', ' cc ' =>null, ' DD ' =>false); echo "Isset aa is"; Var_dump (Isset ($test _arr[' AA ')); 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 (' AA ', $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 <100; $i + +) { Isset ($test _arr[' AA '); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "Isset is $time \ n"; for ($i =0; $i <10000; $i + +) { Isset ($test _arr[' AA '); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "Isset 10000 is $time \ n"; for ($i =0; $i <1000000; $i + +) { Isset ($test _arr[' AA '); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "Isset 1000000 is $time \ n"; //++++++++++++++++++++++++++++++ $time _start = Microtime_float (); for ($i =0; $i <100; $i + +) { Array_key_exists (' AA ', $test _arr); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "Array_key_exists is $time \ n"; for ($i =0; $i <10000; $i + +) { Array_key_exists (' AA ', $test _arr); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "array_key_exists 10000 is $time \ n"; for ($i =0; $i <1000000; $i + +) { Array_key_exists (' AA ', $test _arr); } $time _end = Microtime_float (); $time = $time _end-$time _start; echo "Array_key_exists 1000000 is $time \ n"; |