83 of 110 menu

PHP Array Element Existence Check

The in_array function checks for the existence of a given element in an array.

Let an array be given. Let's check for the presence of an element with the value 'b' in it:

<?php $arr = ['a', 'b', 'c']; $elem = in_array('b', $arr) var_dump($elem); ?>

Code execution result:

true
English
БеларускаяEspañolРусский
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline