Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Financial management functions Jump to:  
Category: >> PHP Code >> Financial management functions Bookmark and Share

<< lastnext >>

Snippet Name: Financial management functions

Description: A suite of financial management functions, including present and future value of an annuity and a loan payment calculation function.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009

$m  =  number  of  periods  per  year.    For  instance,  if  you  are  For   
instance,  if  you  are  making  payments  monthly  then  this  number  is  12. 
$n  =  total  number  of  periods.    For  instance,  if  you  are   
compounding  monthly  for  5  years,  this  number  would  be  60  (12  months   
x  5  years). 
$R  =  annual  interest  rate  (represented  as  a  decimal,  8%  =  .08) 
$pmt  =  first  or  re-occuring  payment  or  receipt  (this  number  cannot   
vary  for  differing  cash  flows) 
$principal  =  present  value  of  an  annuity,  or  current  principal  of  a   
loan  used  in  the  PaymentCalc  function 
//  present  value  of  an  Annuity   
//  uses  include  defining  Remaining  Principal  of  a  loan/mortgage 
FUNCTION  PVannuity  ($m,$n,$R,$pmt)  { 
        $Z  =  1  /  (1  +  ($R/$m)); 
        RETURN  ($pmt  *  $Z  *  (1  -  POW($Z,$n)))/(1  -  $Z); 
//  Given  the  compounding,  principal,  interest  rate,  you  can  calculate   
the  monthly  payment 
FUNCTION  PaymentCalc  ($m,$n,$R,$principal)  { 
        $Z  =  1  /  (1  +  ($R/$m)); 
        RETURN  ((1  -  $Z)  *  $principal)  /  ($Z  *  (1  -  POW($Z,$n))); 
//  future  value  of  an  Annuity 
FUNCTION  FVannuity  ($m,$n,$R,$pmt)  { 
        RETURN  $pmt  *  ((POW((1  +  $R/$n),$m)  -  1)/($R/$n)); 
//  present  value  of  a  single  payment 
FUNCTION  PVsingle  ($m,$n,$R,$pmt)  { 
        RETURN  $pmt  *  POW((1  +  $R/$m),-$n); 
//  future  value  of  a  single  payment 
FUNCTION  FVsingle  ($m,$n,$R,$pmt)  { 
        RETURN  $pmt  *  POW((1  +  $R/$m),$n); 
//  future  value  of  a  single  payment  with  continuous  compounding 
FUNCTION  FVperp  ($m,$n,$R,$pmt)  { 
        RETURN  $pmt  *  EXP($R  *  ($n/$m)); 

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 117 users online    © 2009 psoug.org

Forgot your password?