This is an issue of operator precedence, in your case, the &&
evaluates before the =
, leading to the errors you describe.
You can resolve this problem by placing the assignment statement inside of a parentheses.
Explicitly, your code should read
if( (list($day, $month, $year) = explode('-', $active_from))
&& !checkdate($month, $day, $year)) {
Note that I have changed it from if( $a=$b && $c )
to if( ($a=$b) && $c )
. The parentheses force the assignment operator (=
) to evaluate before the conjunction (&&
), which is what you want.