Hello EveryOne

I confuse of bellow code

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php}else{?>
    <a href="/#"> Aleary applied </a> 
<?php }?>

Given Me Error Parse error: syntax error, unexpected '}'
BUT Solved It: When i replace '<?php' else to '<?' it could be solved.

But why it was Happen i could not understand.
Any One suggest me ?

Thank You.

Recommended Answers

I recommend to insert spaces:

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php } else { ?>
    <a href="/#"> Aleary applied </a> 
<?php } ?>
Jump to Post

All 4 Replies

line 3 should be <?php else { ?>

I recommend to insert spaces:

<?php if($True == 0){ ?>
    <a href="/#"> Apply </a>
<?php } else { ?>
    <a href="/#"> Aleary applied </a> 
<?php } ?>
commented: @AndrisP : Thank You. +1

Sorry I was wrong.

good catched AndrisP. Spaces indeed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.