Normal and bold text with a function in PHP

Description

The following code shows how to normal and bold text with a function.

Example


<!DOCTYPE html>/*from  w  ww .  jav a  2 s.c o m*/
<html>
  <body>
    <h1>Normal and bold text</h1>
    <?php
    
    function makeBold( $text ) {
     return "<b>$text</b>";
    }
    
    $normalText = "This is normal text.";
    $boldText = makeBold( "This is bold text." );
    echo "<p>$normalText</p>";
    echo "<p>$boldText</p>";
    
    ?>

  </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