Logo

Programming-Idioms

History of Idiom 12 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-18, 20:55:21

Version 8

2015-08-20, 07:59:55

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is any iterable finite container.

Idiom #12 Check if list contains a value

Check if list contains a value x.
list is any iterable finite container.

Code
in_array ( $x, $list, true );
Comments bubble
/* in_array returns true if value exists in $list */

/* last argument should be set to true. Otherwise unexpected behavior is very likely to happen, for details see php manual */