Search a list of records

From Rosetta Code
Revision as of 04:48, 10 October 2015 by Rdm (talk | contribs)
Search a list of records is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Perl

<lang perl>if(grep $_ eq $needle, @haystack) { print 'Found'; }</lang>

PHP

<lang PHP>echo in_array('needle', ['hay', 'stack']) ? 'Found' : 'Not found';</lang>