Create a simple function with one parameter in PHP

Description

The following code shows how to create a simple function with one parameter.

Example


/*w w w. j  a  va  2 s .  c  o m*/
<?php
  function printBold($text)
  {
    print("<b>$text</b>");
  }

  print("This Line is not Bold<br>\n");
  printBold("This Line is Bold");
  print("<br>\n");
  print("This Line is not Bold<br>\n");
?>

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