I have the following array($post_options), it can appear in various guises, the key is dynamic:
It might be like this:
array(1) { [95]=> string(2) "25" }
It might be like this, the key can be anything:
array(1) { [05]=> string(2) "" }
I want to add a control statement that controls upon whether or not the value in the first key element has a value.
I have this code:
if (!isset($post_options[0])) {
// value is empty
var_dump($post_options);
}
else {
// value has value
echo 'Option Selected';
}
But this is not working, it returns true when the value is set and not set. What is the solution here? Thanks
So if the array appears like this (the value of the first key is empty):
array(1) { [05]=> string(2) "" }
I want to var_dump(); in this case
null? Must the value not be the empty string? How about any other "empty" value? There's so many options here. What precisely do you want?