PHP - The if Statement

codinger 21 Apr 2023 | 6:18 pm PHP, PHP Statements

 

PHP if Statements

PHP में if Statements, One Condition का एक Code सत्य (True) करता है।

PHP में if Statements लिखने का Syntax-

if (condition) {
  code to be executed if condition is true;
}

PHP में if Statements को हम नीचे दिए गये कुछ उदाहरणों द्वारा समझते हैं-

Example 1.

<?php

$x = 5;

if ($x <= 5) {

echo "Yes, You are Right";

}else{

echo "No, You are Wrong";

}

?>

Browser Preview

Yes, You are Right

Example 2

$Day = "Sunday";

if ($Day == Sunday){

echo "Today is Sunday";

}else{

echo "Today is not a Sunday";

}

?>

Browser Preview

Today is Sunday

 

Share

Related Posts



Comments:-


Please login to comment..