Comma Operator PHP

Viewed 3572

Both these statements are true:

$_POST['foo'] = $_POST['bar'] = 'some string';

//1. with '&&' operator
if(isset($_POST['foo']) && isset($_POST['bar'])) { 
    echo true; 
}

//2. with a comma
if(isset($_POST['foo'], $_POST['bar'])) { 
    echo true; 
}

What is the difference (if any) between them?

4 Answers
Related