if array key exists remove that key php code example
Example 1: php key exists
$fruits = ['apple', 'pear', 'banana'];
if (array_key_exists("banana", $fruits)) {
}
$exists = array_key_exists("peach", $fruits);
Example 2: php key in array exists
<?php
$search_array = array('first' => null, 'second' => 4);
isset($search_array['first']);
array_key_exists('first', $search_array);
?>
Example 3: if don't exist key json php
<?php
$search_array = array('first' => 1, 'second' => 4);
if (array_key_exists('first', $search_array)) {
echo "The 'first' element is in the array";
}
?>