Skip to main content
Report this ad

See also:

Using functions in a PHP program (part 1)

Logo.php...  PHP function program
Logo.php... PHP function program
Ginny Putscher

As your programming code grows, it is much easier to use functions. Functions are pieces of code that are more manageable and you can reuse the same programming code wherever it is necessary to perform a specific task. A function is a group of PHP statements within a PHP program that work independently. PHP has a number of built-in functions; you can also create your own functions.

The PHP programming code listed below demonstrates displaying a company logo.

NOTE: The jpeg images are stored in the "C:\WAMPSERVER\www\images" folder. As demonstrated in the previous programs, we used notepad a plain text editor. The PHP programs are stored on our web server, "C:\Wampserver\www." Please note the stored web server location.

Now let us create the PHP program, please follow the steps outlined below:

  1. Select and click "Start."
  2. Select and click "All Programs."
  3. Select and click "Accessories."
  4. Select and click "Notepad."
  5. Type the PHP code exactly as shown below.
  6. Once you have type the entire program, Select "File," "Save As," and then go to the webroot of your server. For example, C:\Wampserver\www. Type Filename, "logo.php," and then Select "Save."







<h3>Demonstrates LOGO<h3>


print "<p><img src = 'images/JONESLOGO.jpg' width='700' height='125'/><p>";

print "<p style='font-size: large'>The Finest Florist </p>";

print "<p style='font-style: italic'>beautiful creative designs</p>";





As shown it takes three lines of code to display a company logo.

Use your browser to view the logo.php program. The steps are outlined below:

  1. Select and click "Start. "
  2. Select and click "All Programs."
  3. Select and click "Internet Explorer."
  4. Locate the Web Address Field, near the top-left of the Internet Explorer window and type in the Web address of the logo.php program, "http://localhost/logo.php," then enter.

In our next article, Using functions in a PHP program (part 2), we will demonstrate how to use the function block.

Report this ad