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!
I am learning PHP and im learning PHP Constants. On my webpage it says
Parse error: syntax error, unexpected '>' in C:\Inetpub\vhosts\tagslash.com\httpdocs\constants.php on line 14
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Constants</title>
</head>
<body>
<?php # Script 1.9 - constants.php
// Set today's date as a constant:
define ('TODAY', 'August 28, 2007);
// Print a message, using predefined constants and the TODAY constant:
echo '<p>Today is ' . TODAY . '.<br />This server is running version <b>' . PHP_VERSION . '</b> of PHP on the <b>' . PHP_OS . '</b> operating system.</p>';
?>
</body>
</html>
You are missing the closing single quote (') at the end of your date:
define ('TODAY', 'August 28, 2007);
should be:
define ('TODAY', 'August 28, 2007');
Without that closing quote, PHP thinks that everything that follows is part of the quoted string until it gets to another single quote.