User gives me a $_POST, I want to check whether keys (not the values) are there.
$_POST keys need to be newemail, firstPassword and secondPassword.

What I have tried:
if (in_array(array_keys($_POST), array("newemail", "firstPassword", "secondPassword"))) echo "Everything in order"..

How to make it actually work?

Recommended Answers

All 2 Replies

http://php.net/array_intersect

The result of the intersect of both arrays, should be an array identical to array("newemail", "firstPassword", "secondPassword")

So, if you do an array_diff() on those two next, you should have an empty array.

Hope it makes sense.

It's so hard, yet so easy. Exactly that. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.