当isset满足时,php不会打印所有行

In the under quoted code when the "isset" is satisfied (all are true) I get only the first 2 lines printed rather than all 3.

Can anyone help please?

griffo

<?php //Rise on previous day set the current day and rise again on current day  
        } elseif  (isset ($moonriseprior) and isset ($moonset) and isset ($moonrise) )
        { print 'Moonrise' . ':' ; ?> 
        <span style="color: #FFD400;"> <?php print $moonriseprior .  ' (' . $moonrisepriordate . ')' ;?></span> <br/>
        <?php print 'Moonset' . ': ' . $moonset . ' (' . $moonsetdate . ')'. '<br>' ; ?> 
        <?php print 'Moonrise' . ':' . $moonrise. ' (' . $moonrisedate . ')' ; ?>
   if(isset($moonriseprior) && isset($moonset) && isset($moonrise)){
      echo 'Moonrise:<span style="color: #FFD400;">'.$moonriseprior.'('.$moonrisepriordate.')<span><br>';
      echo 'Moonset:'.$moonset.'('.$moonsetdate.')<br>';
      echo 'Moonrise:'.$moonrise.'('.$moonrisedate.')';
    }

    # maybe take a look at sprintf.
    echo sprinf('Moonrise:<span style="color: #FFD400;">%s (%s)</span><br>', $moonriseprior, $moonrisepriordate);

Avoid mixing in too much of <?php ?> tags, they are ugly and pollute your code making it unreadable. More importantly though, always code in the same behavior.