check where key in associative array have a value
// 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);<?php
$search_array = array('first' => 1, 'second' => 4);
if (array_key_exists('first', $search_array)) {
echo "The 'first' element is in the array";
}
?>
Also in PHP:
- codeigniter get insert iditer print last query
- create qr code png image of 200*200 using phpqrcode
- data type checking php
- cache laravel example
- calculate total time from start and end datetime in php
- clear cach php artisan
- comment acceder à la base de données phpmyadmin sur mac ave
- Cache::forget laravel command
- executar comando linux php
- echo foreach
- detect keyword of php string
- date time function to php date
- centos 7 install php composer
- array_unique
- explain email injection
- create a folder php
- check text is in string or not php
- api newslater with php
- csv to json php
- datetime format
- add one day in date php
- execute composer with php version
- Format Month as a number php
- How do you clear cache in Laravel?