Re: [PHP] Benchmarking check to see if array key is set

2007-11-08 Thread Peter Ford
Ford, Mike wrote: > On 06 November 2007 12:57, Christoph Boget wrote: > >> Consider the following test code: > > [...snip...] > >> Running that I found that >> >> if( isset( $myArray[$key] )) >> >> is faster than >> >> if( array key exists( $key, $myArray )) >> >> is faster than >> >> if( $myAr

RE: [PHP] Benchmarking check to see if array key is set

2007-11-06 Thread Ford, Mike
On 06 November 2007 12:57, Christoph Boget wrote: > Consider the following test code: [...snip...] > Running that I found that > > if( isset( $myArray[$key] )) > > is faster than > > if( array key exists( $key, $myArray )) > > is faster than > > if( $myArray[$key] ) > > To be honest, I wa

[PHP] Benchmarking check to see if array key is set

2007-11-06 Thread Christoph Boget
Consider the following test code: '; $startTime = microtime( TRUE ); $foundCount = 0; for( $i = 0; $i <= 1; $i++ ) { $date = microtime( TRUE ); $key = rand( $date, $date * rand( 1, 5000 )); if( array key exists( $key, $myArray )) { $foundCount++; } } $e