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

All 4 Replies

Member Avatar for iamthwee

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
Member Avatar for iamthwee

Sorry I was wrong.

good catched AndrisP. Spaces indeed.

Be a part of the DaniWeb community

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