Page 1 of 1

Dumb question of the day!

Posted: Mon Feb 24, 2003 2:20 pm
by dwcooper
Can anyone tell me why I get a PARSE ERROR when trying to assign a value to a variable? These only happen where there is a FUNCTION defined.

<?php
function david() {
$a = "Hello";
    }
?>

Gives me a parse error, regardless of the function name I give or the variable name I assign.

Parse error: parse error in /Library/WebServer/Documents/phpfunction.php on line 1


Whenever I paste code snippets from sites I get errors as well when there are FUNCTIONS present?

It's driving me nuts. Feel free to point out my stupid error.

Running on Mac OSX Server.

Posted: Mon Feb 24, 2003 2:33 pm
by BDKR
Is "<?php" of your code. Is there any white or blank space above the opening php tag? Also, what happens if you open it with "<?" instead?

Just some ideas...

Cheers,
BDKR

Posted: Mon Feb 24, 2003 2:44 pm
by dwcooper
Blank space above the opening php tag...

Oh, how much time did I spend on that!!!!!

Thanks much.