Newbie

Parse Error in line 8. What am I missing? Thanks.

<?php

$length = 10.5;
$width = 20.5;

print ???the length is: $length
??

i think there are some problems with double quotes…

it works fine for me…

Thanks shaa. I’m taking an Intro to Programming class at the local community college and apparently I’m not taking good enough notes. I’m trying to pass between functions. I need my second function for the variable $Sales_tax to go into my first function and use variable $final_price, but don’t understand the scoping involved.

<?php 
//*****************************************************************
//*                         Victor Losen                          *
//*****************************************************************
//*  This program get information on a customer and product and   *
//*  computes a bill.                                             *
//*****************************************************************

// compute the discounts first
compute_discounts ($Original_price, &$Discount_savings10, &$Reduced_price,&$Discount_savings5, &$Final_price);

// compute after sale charges second
compute_aftersale ($Sales_tax);

// print the results
print_results ($Salesperson, $Customer, $Product, $Original_price,
$Discount_savings10, $Reduced_price, $Discount_savings5, $Final_price, $Sales_tax);

// this function computes all the discounts for the purchase
function compute_discounts ($Original_price, $Discount_savings10, $Reduced_price, $Discount_savings5, $Final_price)
{
$Discount_savings10 = $Original_price * 0.1;
$Reduced_price = $Original_price - $Discount_savings10;
$Discount_savings5 = $Reduced_price * 0.05;
$Final_price = $Reduced_price - $Discount_savings5;
}

// this funtion computes all after sales charges added to final price
function compute_aftersale ($Sales_tax)
{
$Sales_tax = $Final_price * 7.275;
}

// prints the final results
function print_results ($Salesperson, $Customer, $Product, $Original_price,
$Discount_savings10, $Reduced_price, $Discount_savings5, $Final_price, $Sales_tax)
{
print “Salesperson name: $Salesperson
”;
print “Customer name: $Customer
”;
print “Item to be sent: $Product
”;
print “Original price: $Original_price
”;
print “10% discount: $Discount_savings10
”;
print “Reduced price: $Reduced_price
”;
print “5% discount: $Discount_savings5
”;
print “Final price: $Final_price
”;
print “Sales tax: $Sales_tax
”;
}
?>

Sponsor our Newsletter | Privacy Policy | Terms of Service