Been hung here for a while with the following error:
Parse error: syntax error, unexpected T_VAR on line 12
Have tried moving the code around, changing the php tags, etc - it just doesn't like me starting a line with 'var'
Here's my code:
<html> <p> <?php // Use rand() to print a random number to the screen print rand(0, 20); ?> </p> <p> <?php // Use your knowledge of strlen(), substr(), and rand() to // print a random character from your name to the screen. var $name = "Daniel"; var $length = strlen($name); var $rand = rand(0, $length - 1); var $letter = substr($name[$rand]); ?> </p>
Anyone know a work-around? Just seems like an endless site glitch.