Friday, January 2, 2009

Source code embedding in blog. One simple way found here Following is one sample code snippet

   1:   <?php
   2:  
   3:        /* Initialize some variables using C style comments
   4:  
   5:              $a - contains a-coefficient
   6:  
   7:              $b - contains b-coefficient
   8:  
   9:              $x - value we are evaluating
  10:  
  11:              $y - result from evaluating equation */
  12:  
  13:        $a = 1; $b = 2; $x = 1;
  14:  
  15:        $y = $a * $x + $b;
  16:  
  17:        if ( $y < 5 )                // C++ style comment, check if y<5
  18:  
  19:        {
  20:  
  21:                # Shell style comment, display something when y<5
  22:  
  23:                echo "Guess what?  y is less than 5!";
  24:  
  25:        }
  26:   
  27:   ?>

No comments:

Post a Comment