Logo

Programming-Idioms

History of Idiom 12 > diff from v8 to v9

Edit summary for version 9 by :

Version 8

2015-08-20, 07:59:55

Version 9

2015-08-20, 08:00:31

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 $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 */