check array key php
// Here's our fruity array
$fruits = ['apple', 'pear', 'banana'];
// Use it in an `if` statement
if (array_key_exists("banana", $fruits)) {
// Do stuff because `banana` exists
}
// Store it for later use
$exists = array_key_exists("peach", $fruits);function findKey($array, $keySearch)
{
foreach ($array as $key => $item) {
if ($key == $keySearch) {
echo 'yes, it exists';
return true;
} elseif (is_array($item) && findKey($item, $keySearch)) {
return true;
}
}
return false;
}
Also in PHP:
- brew downgrade php 8 to 7.4
- Too few arguments to function Illuminate\Routing\PendingResourceRegistration::name(), 1 passed in D:\xampp\htdocs\routes\web.php on line 30 and exactly 2 expected
- check method in laravel
- close register of members laravel
- error_reporting e_all & e_notice not working
- case php try catch
- carbon random future date
- check laravel version
- .lenght en php string
- delete cache file laravel
- catch erro message php
- check is char exist in stirng php
- codeigniter select for update
- all error in php
- autocomplete new-password php
- base 64encryption is not happening in php
- base64_decode online php
- codeigniter sms send
- date time long format php
- check if array has a certain key
- Using a variable outside of the while loop (scope)
- add on day to date php
- Call to a function trim() on string laravel
- display php errors in php