, empty isset ( false null) array_key_exists ( ).
if (!isset($_POST['months']) || $_POST['months'] === "")
if (!array_key_exists('months', $_POST) || $_POST['months'] === "")
Since this is POST data, it nullwill never be a value (the browser may either not send the input or send an empty string, which PHP translates to ""). Consequently, issetand array_key_existsinterchangeably. issethowever, it is preferable because it is not a function and therefore works faster (not to mention writing it faster).
source
share