I want to declare a variable in a if
statement and use it in the same statement. Is this simply not possible?
Example of problem (not actual use case though...):
if ($test = array('test'=>5) && $test['test'] === 5) {
echo 'test';
} else {
echo 'nope';
}
Error message:
NOTICE Undefined variable: test on line number 6
Aucun commentaire:
Enregistrer un commentaire