Practice Exercise: Report with Functions

               
Objective:  Be able to create and invoke a PHP function.

   The general form for a function is: 
   function functionName ( [formal parameter list] ) {
       statements
       [return expression;]
   }

   The general form for a function call is:
      [variable  = ] functionName( [arguments or actual parameter list] );
      
0. Define a void* function named printHeadings that receives no parameters
   but prints a report title line containing the string "Item Report", and
   prints headings for columns with strings "id", "name", "cost", "qty" and
   "value".  
   *does not return a value



 
  



1. Prepare a function named printDetail with value parameters for $id, $name,
   $cost, $qty and $value. Print the parameter values.

   
   



   
      
2. Define a void function named printFooting that receives the parameter
   $totalValue. It should print a line with the side label "total:" and 
   the value referenced by $totalValue decimal-aligned with the value column
   in the body of the report.






   
4. Invoke printHeadings(). 



5. Within the "main" block of code, prepare a loop to control access to 
   "item.csv" file records, compute value as the product of $cost and $qty,
   call printDetail() passing arguments $id, $name, $cost, $qty, $value,
   and accumulate value in $totalValue.






6. Invoke printFooting passing it the variable $totalValue.