Logo

Programming-Idioms

History of Idiom 52 > diff from v34 to v35

Edit summary for version 35 by programming-idioms.org:
[PHP] The 3rd parameter does not seem not be about case sensitivity

Version 34

2020-04-26, 17:21:36

Version 35

2020-04-26, 17:31:43

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Illustration

Idiom #52 Check if map contains value

Determine whether map m contains an entry with value v, for some key.

Illustration
Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
in_array($v, $m, true);
Code
in_array($v, $m, true);
Comments bubble
arrays in PHP are maps.

Set the 3rd parameter to false if you want a type-insensitive check.
Comments bubble
Arrays in PHP are maps.

The 3rd parameter is for type strictness.
Doc URL
https://www.php.net/in_array
Doc URL
https://www.php.net/in_array
Demo URL
https://3v4l.org/0KhIp
Demo URL
https://3v4l.org/0KhIp