Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
36 of 110 menu

PHP Check Element in Array

To check an element in an array, you can use the in_array function.

Let the following array be given:

<?php $arr = ['a', 'b', 'c']; ?>

Let's check using in_array if the element 'b' is in this array:

<?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