Weird Problem

Status
Not open for further replies.

Murdoc

In Runtime
Messages
109
Weird Problem (PHP)

I've made my own script and tried to execute the script at command prompt (linux) using command php -f hypotenuse.php

I kept getting this error:

Parse error: parse error, unexpected T_VARIABLE in /home/murdoc/public_html/mdlabs/hypotenuse.php on line 12

Code:

// Start Date: Nov 3 2005 [10:21 pm]
//Last modified: Nov 3 2005 [ 10:38 pm]
//Purpose: Create a program to calculate Hypotnuse of a triangle

<?php
echo "Please enter value for A:"; //Prompt for A value
$a = trim (fgets(STDIN)); // Keyboard input
echo "Please enter value for B:"; //Prompt for B value
$b = trim (fgets(STDIN)); // Keyboard input
$c = (($a*$a) + ($b*$b)) // Calculating (A^2) + (B^2)
$d = sqrt($c);
printf ("The Hypotenuse is "."$d"); // Final output
?>
 
the dot outside is concatination. I've built another script at school that worked fine and so I used it here but it's not working on my computer and I was wondering what could've caused it = /
 
Status
Not open for further replies.
Back
Top Bottom