Output data from php code and add style in PHP

Description

The following code shows how to output data from php code and add style.

Example


<!DOCTYPE html>/* ww  w.  j a v  a2 s . c  om*/
<html>
  <body>
    <h1>Saying hello with style</h1>
    <?php
    
    function helloWithStyle( $font, $size=1.5 ) {
     echo "<p style=\"font-family: $font; font-size: {$size}em;\">Hello, world!</p>";
    }
    
    helloWithStyle( "Helvetica", 2 );
    helloWithStyle( "Times", 3 );
    helloWithStyle( "Courier" );
    
    ?>

  </body>
</html>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition