Forums

conditional statement syntax (2 posts)

  1. m u r
    Member
    Posted 2 years ago #

    Is this correct syntax? PLEASE help:

    <?php
    if(is_home()){ echo '';}
    else if(is_category(4)){ echo '';}
    else { echo '';}
    ?>

    It doesn't seem to work the first time. If I refresh it works fine.

  2. jonradio
    Member
    Posted 2 years ago #

    Yes, the syntax is correct, as shown here:
    http://www.php.net/manual/en/control-structures.elseif.php

    But, I assume you actually have something different in each of those empty quoted strings for each echo, as that statement as it stands now could be simplified into just:
    echo "";

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.