PHP Switch Statement

PHP Switch Statement In Hindi

PHP
Loading...

PHP Switch Statement In Hindi – Switch Case Statement – Jab Kisi Program Me Bahut Sari if condition Ka Istemal Karte Hai to Program Bahut Jyada Complex Ban Jata Hai Jisse Samanjh Ne Me Jyada Dikkat Hoti | Issi Se Bachne Ke Liye Ham Switch statement in Hindi Ko Istemal Karte Hai |

Switch Statement In PHP In Hindi

Jis Tarah If Else Condition kaam karti ussi tarah switch statement kaam karta hai.

Switch Ek Conditional Branching Statement Hai Jiska Pryog Ek Variable Ki Value Ke Anushar Bahut Sare Case Ko Check Karne Ke Liye Kiya Jata Hai | Iski Shurwat Mei Switch Statement Ke Sath Ek Variable Hota Hai, Bich Mei Case Statement Ke Sath Bahut Sare Statement Block Hote Hai Or End Mei Default Statement Ke Sath Default Statement BLock Hota Hai |

Isme Shurwat Se Ek Ek Karke Variable Ki Value Ke Sath Sabhi Case Ko Check Kiya Jata Hai | Yadi Koi Bhi Case Variable Ki Value Se Match Karta Hai To Is Case Ke Under Likhe Statement Block Ko Execute Kiya Jata Hai | Or Yadi Koi Bhi Case Variable ki Value Se Match Nahi Karta Hai | To End Mei Default Statement Block Ko Execute Kiya Jata Hai | Iska Syntax Aap Niche Dekh Sakte Hai |

Aap Niche Diye Gaye Flow Chart Ko Dekh Kar Switch Statement  Ko Understand Kar Sakte Hai |

Switch Statement In C

Syntax

switch (n)
{
    case 1:      // code to be executed if n = 1;
        break;

    case 2:     // code to be executed if n = 2;
        break;

    default: 
               // code to be executed if n doesn't match any cases
}

Example

<?php
$today = date("D");
switch($today){
    case "Mon":
        echo "Today is Monday. Clean your house.";
        break;
    case "Tue":
        echo "Today is Tuesday. Buy some food.";
        break;
    case "Wed":
        echo "Today is Wednesday. Visit a doctor.";
        break;
    case "Thu":
        echo "Today is Thursday. Repair your car.";
        break;
    case "Fri":
        echo "Today is Friday. Party tonight.";
        break;
    case "Sat":
        echo "Today is Saturday. Its movie time.";
        break;
    case "Sun":
        echo "Today is Sunday. Do some rest.";
        break;
    default:
        echo "No information available for that day.";
        break;
}
?>

Output:

Today is Saturday. Its movie time.

Friends Mujhe Umeed Hai Ki Aapko PHP Switch Conditions In Hindi Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mere Se Contact Kar Sakte Hai |

Leave a Reply

Your email address will not be published.