$foo = array('one');
$foofoo = array('onekey' => 'onevalue');
How do you check if an array contains only one key?
count()
will tell you how many elements are in an array
if (count($foo) === 1) {
echo 'This array contains one value';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With