Mega Code Archive

 
Categories / Php / Functions
 

Nesting functions

<?php function myFunction($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); } myFunction(15.00,.075); echo convert_pound(15); ?>