note 38667 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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;
}

?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.