Amazon.com: PC Books || Educational Software || Magazines
Amazon: Books-CA || Software-CA || Books-UK || Software-UK

HTML | Javascript | ASP | PHP | VBScript | SQL | Hardware | PC FAQ| WinXP|

Learn to Build, Upgrade, or Repair your Computer Ebook + PC Safety 101 kwwebservice.com Reasonably priced web development & hosting
PHP Basics
Introduction
Variables & Arrays
Sub & Functions
If Statements
Case Statements
Loop Statements
Date Objects
Form Processing
Text File Objects
Database Access
Adding Record
Updating Record
Deleting Record
Virtual Includes
Cookies
Session
Server Variables
Creating Login Page
E-mail
PHP Books @
CA Amazon
UK Amazon
US Amazon

  :: Home
PC Topics
  :: Build A PC
  :: Windows XP
  :: PC Help
Tutorials
  :: HTML
  :: JavaScript
  :: ASP
  :: PHP
  :: VBScript
  :: SQL
Miscellaneous
  :: Code/Scripts
  :: Forum
  :: Links
  :: Contact us
  :: Tell A Friend
  :: In Somali
  ::
Web Articles
  Top Web Hosting
Reviews
  Processing
Online Card Payment Guide
  Domain name
registration & buying guide
  Getting
a website online guide
  Search Engine
submission & optimization tips
Netfirms Web Hosting
Free trial
Quality business correspondence.
Yahoo! Search Marketing

PHP Function Procedures

A Function procedure is a series of php statements enclosed together. A Function takes values, process them, and returns processed result. A Function procedure can take arguments (variables, or print statements).

Here is a syntax for none-parameterize function:
<?php
function welcome()
{
  $greeting="<h4>Welcome to my web site</h4>";
  print "$greeting";
}
?>
This function remembers the statement "Welcome to my web site". You can use this function any number of times in your program and you change it once in here to maintain. Use welcome() to call this function.
For example;<?php welcome(); ?> will execute the function.
The result will look like:

Welcome to my web site

Here is a syntax for parameterize function:
<?php
Function total($price)
{
$tax=$price*.09;
$total=$price+$tax;
return $total;
}
?>
The price value is provided when calling the function.
eg; echo total(50);

The following example is function procedure that takes an argument variables (price, cost) and returns calculates profit after tax.
<?php
function profit($sellPrice, $cost)
{
  $taxRate=0.09;
  $tax=$sellPrice*$taxRate;
  $profit=$sellPrice-($cost+$tax);
  return $profit;
}
print "Total profit $".profit(100,50);
?>
Execution result:
Total profit $41

Variables & Arrays If Statements
Listed @ ConsumerVote.com - The Consumer Rated Web Directory
PC Articles
  Computer Safety
prevent viruses & Spyware