Originally Posted by
sherlyk
http://php.flashwebhost.com/sherly/abc.php
Code:
Parse error: syntax error, unexpected '{' in /home/fwhphp/public_html/sherly/abc.php on line 5
Code:
<?php
if ($a > $b) {
echo 'a is bigger than b';
} esleif ($a == $b) {
echo 'a is equal to b';
} else ($a < $b) {
echo 'a is smaller than b';
}
First of all, where did you set $a and $b ? With out such a variable how it works ?
The error is because
Spelling mistake, use else if
Fixed code
Code:
<?php
$a = 1;
$b = 100;
if ($a > $b) {
echo 'a is bigger than b';
} else if ($a == $b) {
echo 'a is equal to b';
} else ($a < $b) {
echo 'a is smaller than b';
}
echo '<p>Value of $a = ' . $a . ' and value of $b = ' . $b . '</p>';
Bookmarks