PHP Array

Last Updated: August 14, 2021

In PHP there are two types of array

1 index array

2 associative array

PHP Array functions

array_key_exists

Check whether the key exists in PHP associative array

<?php
$search_array = array('first' => 1, 'second' => 4);
if (array_key_exists('first', $search_array)) {
    echo "The 'first' element is in the array";
}
?>