...

View Full Version : T_IF PHP Parse Error



buildblocks
04-12-2012, 03:12 PM
I get this: [12-Apr-2012 15:02:17] PHP Parse error: syntax error, unexpected T_IF in /home/sbot/public_html/index.php on line 5

Here is my code:


<?php

$password = 'alex'

if ($password=='alex'); {
echo 'This is the correct password!';
}

?>


Line 5 is: if ($password=='alex'); {

buildblocks
04-12-2012, 03:15 PM
Ahh, Got it

tangoforce
04-12-2012, 03:15 PM
I get this: [12-Apr-2012 15:02:17] PHP Parse error: syntax error, unexpected T_IF in /home/sbot/public_html/index.php on line 5

Here is my code:


<?php

$password = 'alex'

if ($password=='alex'); {
echo 'This is the correct password!';
}

?>


Line 5 is: if ($password=='alex'); {

You need a ; on the end of your $password line:

$password = 'alex';

Fou-Lu
04-12-2012, 03:20 PM
Yes, but make sure your remove the ; at the end of the if check.


if (false);
{
print 'I\'m in here.';
}

Will print that its in the branch.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum