check if array has a 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:
- cache clear in code php laravel
- DATE fromat H:i j M Y
- codeigniter id of last insert
- base64 to image
- datetime to string php
- array exists in php
- check string php
- artisan seed
- date year php
- find all files in directory php
- Class 'App\Http\Controllers\Auth' not found
- check composer version php
- data seeder in laravel
- Class 'Intervention\Image\ImageServiceProvider' not found
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://D:/Program Files/Composer - PHP/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
- echo json in php formated
- creating new project laravel
- C:\MyScans in php server run file
- How to show php text
- Codeigniter count query results
- create user laravel seeder
- currunt date time in php
- error enable in php
- It is possible to perform an HTTPS redirect using PHP code as well as writing PHP code to prevent the browser from caching your we