हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा १२

Explain if else statement in PHP. With an example.

Advertisements
Advertisements

प्रश्न

Explain if else statement in PHP. With an example.

संक्षेप में उत्तर
Advertisements

उत्तर

If a statement executes a statement or a group of statements if a specific condition is satisfied by the user expectation. When the condition gets false (fail) the else block is executed.

Syntax:

if (condition)
{
Execute statement(s) if condition is true;
} else
{
Execute statement(s) if condition is false;
}

Example:

<?php
$Pass_Mark=35;
$Student_Mark=70;
if ($Student_Mark>= $Pass_Mark)
{
echo “The Student is eligible for the promotion”;
}
else
{
echo “The Student is not eligible for the promotion”; }
?>
shaalaa.com
Control structures in PHP
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: PHP Conditional Statements - Evaluation - PART – IV [पृष्ठ १११]

APPEARS IN

सामाचीर कलवी Computer Applications [English] Class 12 TN Board
अध्याय 6 PHP Conditional Statements
Evaluation - PART – IV | Q 5. | पृष्ठ १११
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×