Nested function : Nested Functions : Functions PHP Source Code


PHP Source Code » Functions » Nested Functions »

 

Nested function




<?php
   function salestax($price,$tax) {
      function convert_pound($dollars, $conversion=1.6) {
         return $dollars * $conversion;
      }
      $total = $price + ($price * $tax);
      echo "Total cost in dollars: $total. Cost in British pounds: ".convert_pound($total);
   }

salestax(15.00,.075);
echo convert_pound(15);

?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Functions
» Nested Functions