34 of 110 menu

PHP Array Search

To search an array, use the array_search function. It returns the key of the found element. 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