note 38667 deleted from function.in-array by felipe

From: Date: Sun, 30 Dec 2007 18:52:21 +0000
Subject: note 38667 deleted from function.in-array by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134470@lists.php.net to get a copy of this message
Note Submitter: gphemsley at users dot sourceforge dot net ---- For those of you who need in_array() for PHP3, this function should do the trick. <?php function in_array( $needle, $haystack, $strict = FALSE ) { @reset( $haystack ); while( @list( , $value ) = @each( $haystack ) ) { if( $needle == $value ) { if( $strict && ( gettype( $needle ) != gettype( $value ) ) ) { return FALSE; } else { return TRUE; } } } return FALSE; } ?>

« previous php.notes (#134470) next »