I have a variety of arrays that will either contain
story & message
or just
story
How would I check to see if an array contains both story and message? array_key_exists()
only looks for that single key in the array.
Is there a way to do this?
Something as this could be used
Updates
In one fat function:
So for example with this:
Hope this helps :)
This is old and will probably get buried, but this is my attempt.
I had an issue similar to @Ryan. In some cases, I needed to only check if at least 1 key was in an array, and in some cases, all needed to be present.
So I wrote this function:
This was a lot easier than having to write multiple
||
and&&
blocks.//run demo
Does this not work?
I am not sure, if it is bad idea but I use very simple foreach loop to check multiple array key.