0

Why is it saying "Parse error: syntax error, unexpected 'print' (T_PRINT)..."?

<?php 

//init
$pi = 3.14;
$radius = 15;
$theArea = 0;

//area = 2 pi R
$theArea = $pi * ($radius * $radius)

//output
print ("The area of a circle of radius ".$radius." is " . $theArea);

?>
TLK
  • 1

1 Answers1

0

You forgot to add a semicolon for the statement before the print

//area = 2 pi R
$theArea = $pi * ($radius * $radius); //here

Also you can use print without the parenthesis, since it's a language construct.

print "The area of a circle of radius " . $radius . " is " . $theArea;

Unless you really want to

Alex Andrei
  • 7,315
  • 3
  • 28
  • 42