Hello. I have a new blog.

I've moved this blog to the following URL Kerkness.ca. Thank you for visiting, please update your bookmarks.

Thursday, February 21, 2008

PHP in_array() function in ActionScript for Flex

Another common PHP function is in_array() used to determine if a value exsists in an array. Here is the function recreated in actionscript for flex.

public function in_array( needle:*, haystack:Array ):Boolean
{
var itemIndex:int = haystack.indexOf( needle );
return ( itemIndex < 0 ) ? false : true;
}

No comments:

Post a Comment

Thank you for the comments.