55 of 110 menu

PHP Find an Element in an Array

To search through an array, use the array_search function. See the example:

<?php $arr = [1 => 'a', 2 => 'b', 3 => 'c']; $key = array_search('b', $arr); echo $key; ?>

Code execution result:

2
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