Else construct is generally used when a previous condition does not met, it means that we place the else construct after if statement and if 'if statement' does not met, then the else part will be executed.
We can not put condition with else part, as the name implies that we use else part only when if statement is false, it is also true that we can not use else part alone.
if($a>$b)echo "\$a is greater";
else echo"\$b is greater";
$b is greater
Another way to write if/else block is shown below:
echo"\$a is greater";
else: echo "\$b is greater";
$a is greater
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.