PHP/Functions/Nested Functions — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:37, 26 мая 2010
Nested function
<source lang="html4strict">
<?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); ?>
</source>