Logo

Programming-Idioms

History of Idiom 12 > diff from v18 to v19

Edit summary for version 19 by :

Version 18

2015-08-26, 14:54:47

Version 19

2015-08-26, 19:09:05

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);
Code
in_array ($x, $list, true);
Comments bubble
/* in_array returns true if value exists in array $list */

/* last argument should be set to true. Otherwise unexpected behavior is very likely to happen, for details see php manual */
Comments bubble
in_array returns true if value exists in array $list

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