PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
dwcooper
Forum Newbie
Posts: 4 Joined: Mon Feb 24, 2003 2:20 pm
Location: Toronto
Contact:
Post
by dwcooper » Mon Feb 24, 2003 2:20 pm
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.
BDKR
DevNet Resident
Posts: 1207 Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:
Post
by BDKR » Mon Feb 24, 2003 2:33 pm
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
dwcooper
Forum Newbie
Posts: 4 Joined: Mon Feb 24, 2003 2:20 pm
Location: Toronto
Contact:
Post
by dwcooper » Mon Feb 24, 2003 2:44 pm
Blank space above the opening php tag...
Oh, how much time did I spend on that!!!!!
Thanks much.