Learn PHP
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
Start learning PHP now »
Easy Learning with "PHP Tryit"
With our online "PHP Tryit" editor, you can edit the PHP code, and click on a button to view the result.
Example
Try it Yourself »
Click on the "Try it Yourself" button to see how it works.
PHP Exercises
PHP Examples
Learn by examples! This tutorial supplements all explanations with clarifying examples.
See All PHP Examples
PHP Quiz Test
Learn by taking a quiz! This quiz will give you a signal of how much you know, or do not know, about PHP.
Start PHP Quiz!
My Learning
Track your progress with the free "My Learning" program here at W3Schools.
Log into your account, and start earning points!
This is an optional feature, you can study W3Schools without using My Learning.
PHP References
W3Schools' PHP reference contains different categories of all PHP functions, keywords and constants, along with examples.
Kickstart your career
Get certified by completing the course
Get certified
PHP मे Decision Making Statements विभिन्न कार्यों के आधार पर विभिन्न प्रकार के कार्यों को करने के लिए उपयोग किया जाता है. इसमे if, elseif ...else और Switch Statements का उपयोग अलग Condition मे Decision Making के लिए किया जाता है. आप अपने Decision लेने के लिए Code में Conditional Statements का उपयोग कर सकते हैं.
PHP Three Decision Making Statements को Supports करता है.
if...else statement
elseif statement
switch statement
If...Else Statement
If...Else Statement कुछ Code को Executes करता है यदि कोई Condition True है और दूसरे Code मे अगर वह Condition False है तो हम if...else Statement का उपयोग करते है.
If...Else Statement Example
Output
Have a nice day!
ElseIf Statement
अगर आप कुछ Code को Executes करना चाहते हैं और कई Conditions में से एक सही है तो आप elseif Statement का उपयोग कर सकते है.
ElseIf Statement Example
Output
Have a nice day!
Switch Statement
Switch Statement का उपयोग Execute किये जाने वाले Code के कई Block को Select करने के लिए किया जाता है.
Switch Statement Example
Output
Today is Saturday
PHP Articles in Hindi
Decision making स्टेटमेंट्स का उपयोग करके प्रोग्राम को अलग अलग condition के अनुसार execute कराया जा सकता है।
PHP में decision making statements निम्न है।
- if
- if else
- if else if
- switch
1] if
इसे simple if भी कहते है, अगर इसमें दी हुई condition true होती है तब ही इसका code block[statements] execute होगा।
Syntax
if[condition]{
// statements
}
Example
2] if else
if में दी हुई condition अगर true होगी तो if के statements execute होगा अगर false हुआ तब ही else के statements execute होंगे।
else में condition कभी उपयोग नहीं किया जाता है।
else हमेशा end में ही use किया जाता है।
Syntax
if[condition]{
// statements
}
else
{
// statements
}
3] if else if
अगर प्रोग्राम में एक से अधिक conditions को check कर statements execute कराने के लिए उपयोग किया जाता है।
Syntax
if[condition]
{
// statements
}
else if[condition]
{
// statements
}
else if[condition]
{
// statements
}
else
{
// statements
}
Example