不记得如何在PHP中计算和返回我的值?

Here's my php. i cant remember if i need a return or not. I'm simple trying to take input from a html form and post the information from it and calculate the shipping and tax. i also didn't remember how to use tabs in php so i made my own with $tabthis; .

<?php
    $fname = $_POST["fname"];
    $lname = $_POST["lname"];
    $city = $_POST["city"];
    $province = $_POST["Province"];
    $postal = $_POST["postalcode"];
    $address = $_POST["Address"];
    $tabThis = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $semiTabThis = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $numberOfPizzas = $_POST["numOfPizza"];
    $sizeOfPizzas = $_POST["sizeOfPiz"];
    $cost = 0;
    $ttProduct = 0;
    $shipping = 0;
    function itemAmountAndTax($cost){

        if($numberOfPizzas == 1){
            $cost = 5.75;
            $ttProduct = $cost;
            return $ttproduct;
        }
        else if($numberOfPizzas == 2){
            $cost = 11.50;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 3){
            $cost = 17.25;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 4){
            $cost = 23.00;
            return $cost;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 5){
            $cost = 28.75;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 6){
            $cost = 34.5;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 7){
            $cost = 40.25;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 8){
            $cost = 46;
            $ttProduct = $cost;
        }
        else if($numberOfPizzas == 9){
            $cost = 51.75;
            $ttProduct = $cost;
        }
    }
    function totalCalculator(){

        if( $ttProduct > 0.00 || $ttProduct <= 25.00)
        {
            $shipping = 3.00;
        }
        else if($ttProduct > 25.01 || $ttProduct < 50.00)
        {
            $shipping = 4.00;
        }   
        else if($ttProduct > 50.01 || $ttProduct < 75.00)
        {
            $shipping = 5.00;
        }
        else if($ttProduct > 75.01)
        {
            $shipping = 6.00;
        }
    }
?>
Shipping To: <?php echo $fname; ","; ?> <?php echo $lname; ?><br>
<?php echo $tabThis; ?><?php echo $address; ?><br>
<?php echo $tabThis; ?><?php echo $city; ?><?php echo "" ?><?php echo $province; ?><br>
<?php echo $tabThis; ?><?php echo $postal; ?><br>
Order Information:<br>
<br>
<?php echo $semiTabThis; ?>Your Order is Being Processed, Please verify the information<br>
<?php echo $tabThis; ?><?php echo $numberOfPizzas; ?> Pizza's at <?php?>itemAmountAndTax($cost); each <br>
<?php echo $tabThis; ?>Tax = <?php?><br>
<?php echo $tabThis; ?>Delivery = <?php?><br>
<?php echo $tabThis; ?>Total Cost's = <?php?><br>

Tabs are denoted by "\t". So

$tabThis = "\t\t\t....";

Why don't you declare the price of one pizza as a constant and pass the number of pizzas to a function which simply multiplies the number of pizzas with the price of one pizza??

define("PRICE_OF_ONE_PIZZA",5.75);

function get_pizza_price($num_pizzas) {
 return $num_pizzas*PRICE_OF_ONE_PIZZA;
}//end function

The mentioned '\t' is not what you are looking for since you are outputting HTML to be parsed by the browser. PHP is just a programming language to facilitate the process of generating HTML. The desired way is for you to make a div and do padding-left if you want indentation effect. For this formatting issue you need to learn a bit about html and css.

PHP lets you define functions and return values. But you will need to actually invoke them to execute their functions. You can also global these outside variables in functions to access them directly.

function foo($a){return $a;} 
echo foo('foo');