I am writing code in php and I found that there is a problem in the code:
<?php if(isset($_GET['f'])) { ?>
<?php if($_GET['f']=="message_reçus") { ?>
-- another code here --
<?php } ?>
<?php } ?>
<?php else { ?>
But when I just write it like this:
<?php if(isset($_GET['f'])) { ?>
<?php if($_GET['f']=="message_reçus") { ?>
-- another code here --
<?php } ?>
<?php } else { ?>
He works.
I need a clear explanation of what caused the problem in the first version, because I'm still convinced that both versions are syntactically correct!
PHP Parser shows me: syntax error: syntax error, unexpected 'else' (T_ELSE)
I don’t need any alternative solution, I’m just interested to know why there is a problem in the first version and what is wrong with it!
source
share