I have two php files first is sample.php and the second is if.php. I have some code written in sample.php basically declaration of two variables and an else statement. I have the if statement in if.php file which I'm including before else statement. But on running my code its shows an error:
Unexpected 'else'...etc.
Can you please help me figuring out what is wrong with the code?
Sample.php
<?php
$a=10;
$b=20;
include 'if.php';
else
{
echo $b.' is greater';
}
?>
if.php
<?php
if($a>$b)
{
echo $a.' is greater';
}
?>
Aucun commentaire:
Enregistrer un commentaire