Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 1.34 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What's the difference between enclosing and not enclosing HTML within PHP? [closed]
  2. <?php
  3.     $test = array('a','b','c');
  4.  
  5.     if (isset($test))
  6.         {
  7.         echo    '<div id="testmessage">
  8.                 <h2>
  9.                     Test Message Below
  10.                 </h2>
  11.                 <ul>';
  12.  
  13.         foreach ($test as $t)
  14.             {
  15.             echo '<li>'.$t.'</li>';
  16.             }
  17.  
  18.         echo '</ul>';
  19.         echo '</div>';
  20.  
  21.         }
  22. ?>
  23.        
  24. <?php   $test = array('a','b','c');
  25.         if (isset($test)){
  26. ?>
  27.  
  28.     <div id="testmessage">
  29.         <h2>
  30.             Test Message Below
  31.         </h2>
  32.         <ul>
  33.  
  34.     <?php
  35.         foreach ($test as $t)
  36.         {
  37.     ?>
  38.  
  39.     <li><?php echo $t; ?></li>
  40.  
  41.     <?php
  42.         }
  43.     ?>
  44.  
  45.         </ul>
  46.     </div>
  47.  
  48. <?php
  49. }
  50. ?>
  51.        
  52. <?php  
  53.     $test = array('a','b','c');
  54.     if (isset($test)): ?>
  55.  
  56.     <div id="testmessage">
  57.         <h2>
  58.             Test Message Below
  59.         </h2>
  60.         <ul>
  61.  
  62.     <?php foreach ($test as $t): ?>
  63.  
  64.     <li><?php echo $t; ?></li>
  65.  
  66.     <?php endforeach;    ?>
  67.  
  68.         </ul>
  69.     </div>
  70.  
  71. <?php endif; ?>
  72.        
  73. <?php
  74. $test = array('a','b','c');
  75.  
  76. if (isset($test)){
  77.     echo('<div id="testmessage">');
  78.     echo('<h2>Test Message Below</h2>');
  79.  
  80.     echo('<ul>');
  81.     foreach ($test as $t)       {echo '<li>'.$t.'</li>';}
  82.     echo('</ul>');
  83.  
  84.     echo('</div>');
  85. }
  86. ?>