Skip to main content

Featured Post

What is Salesforce ? Who is salesforce developer?

  1. Introduction to Salesforce Definition : Salesforce is the #1 Cloud-based CRM (Customer Relationship Management) platform that helps businesses manage relationships with customers, automate business processes, and analyze performance. Founded : 1999 by Marc Benioff. Type : SaaS (Software as a Service). Tagline : "No Software" – because everything runs on the cloud, without local installations. 2. Why Salesforce? Traditional CRMs were expensive and required servers, installations, and IT staff. Salesforce revolutionized CRM by moving everything to the cloud . Benefits: 🚀 Faster implementation ☁️ Cloud-based (accessible anywhere) 🔄 Customizable without coding (point-and-click tools) 🤝 Strong ecosystem & AppExchange (marketplace like Google Play for Salesforce apps) 🔐 Security & scalability 3. Salesforce Products & Cloud Offerings Salesforce is not just CRM; it has multiple clouds (modules) for different busine...

Switch Statement In PHP:-


It is used to create option based or choice-based program.we can choose or select a particular option in options set.
Switch contains multiple cases to define multiple options.
switch(option)       //option==optionvalue
{
         case optionvalue:
              optionstatement;
              break;
        case optionvalue:
              optionstatement;
              break;
        case optionvalue:
              optionstatement;
              break;

       default:
          statement;
          break;

}


WAP to display "yes","no" and "cancel"?

<?php

$op='L';
$option = (ord($op)>=65 && ord($op)<=91)?chr(ord($op)+32):$op;
switch($option)
{
case 'y':
echo "YES";
break;
case 'n':
echo "NO";
break;
case 'c':
echo "CANCEL";
break;
default:
echo "INVALID INPUT";
break;
}
?>
ASSIGNMENT:-
1)  WAP to check the greater number using Switch?
2)  WAP to check even or odd using Switch?
3) WAP to check vowel and Consonant using Switch?
4)  WAP to calculate addition, subtraction, multiplication, and division when user press +,-,*, and / Symbol.

Comments

  1. Kritika Barod

    ";
    echo ("a=$a");
    echo ("
    b=$b");
    switch($option)
    {
    case 1:
    if($a>$b)
    {
    echo("
    a is greater than b");
    }
    else
    {
    echo("
    b is greater than a");
    }
    break;
    default;
    echo("invalid");
    }
    ?>

    ReplyDelete
  2. Kritika Barod


    given num is even");
    }
    else
    {
    echo ("
    given num is odd");
    }
    break;
    }

    ?>

    ReplyDelete
  3. Kritika Barod


    $char is vowel";
    break;
    case 'e':
    echo "
    $char is vowel";
    break;
    case 'i':
    echo "
    $char is vowel";
    break;
    case 'o':
    echo "
    $char is vowel";
    break;
    case 'u':
    echo "
    $char is vowel";
    break;
    case 'A':
    echo "
    $char is vowel";
    break;
    case 'E':
    echo "
    $char is vowel";
    break;
    case 'I':
    echo "
    $char is vowel";
    break;
    case 'O':
    echo "
    $char is vowel";
    break;
    case 'U':
    echo "
    $char is vowel";
    break;
    default:
    echo "
    $char is consonant";
    break;
    }
    ?>

    ReplyDelete
  4. Kritika Barod


    ";
    echo "1 Addition
    ";
    echo "2 Subtraction
    ";
    echo "3 multiplication
    ";
    echo "4 Divison
    ";
    $ch='3';
    echo" given no is $a and $b
    ";
    echo "your choice is $ch
    ";
    switch($ch)
    {
    case 1:
    $r = $a+$b;
    echo " Addition = ".$r ;
    break;
    case 2:
    $r = $a-$b;
    echo " Subtraction = ".$r ;
    break;
    case 3:
    $r = $a*$b;
    echo " Multiplication = ".$r ;
    break;
    case 4:
    $r = $a/$b;
    echo " Divison = ".$r ;
    break;
    default:
    echo ("invalid option\n");
    }
    return 0;
    ?>

    ReplyDelete
  5. ";
    echo "
    ";

    $a=300;
    $b=500;

    if($a>$b)
    $greater=$a;
    else
    $greater=$b;

    switch($greater)
    {
    case "$a";
    echo "Answer 'a' is greater number";
    break;
    default:
    echo "Answer 'b' is greater number";
    break;

    }
    ?>

    ReplyDelete
  6. ";
    echo "
    ";

    $num=99;

    echo "Number is- [ $num ]";

    echo "
    ";
    echo "
    ";

    if($num%2==0)
    $num="even";
    else
    $num="odd";

    switch($num)
    {
    case "even";
    echo " This is a even number";
    break;

    default:
    echo "This is a odd number";
    break;
    }
    ?>

    ReplyDelete
  7. ";
    echo "
    ";

    $char='a';

    switch($char)
    {
    case 'a';
    echo "$char is vowel !";
    break;
    case 'e';
    echo "$char is vowel !";
    break;
    case 'i';
    echo "$char is vowel !";
    break;
    case 'o';
    echo "$char is vowel !";
    break;
    case 'u';
    echo "$char is vowel !";
    break;

    case 'A';
    echo "$char is vowel !";
    break;
    case 'E';
    echo "$char is vowel !";
    break;
    case 'I';
    echo "$char is vowel !";
    break;
    case 'O';
    echo "$char is vowel !";
    break;
    case 'U';
    echo "$char is vowel !";
    break;

    default:
    echo "$char is consonant !";
    }

    ?>

    ReplyDelete
  8. Greater Number Using Switch
    Shubham Nandwal

    $a=1002;
    $b=2000;
    $c=2510;
    switch($a)
    {
    case $a>$b && $a>$c;
    echo "a is greater";
    break;
    case $b>$c;
    echo "b is greater";
    break;
    default:
    echo "c is greater";
    break;
    }

    ReplyDelete
  9. Even Odd Using Switch
    Shubham Nandwal

    $a=10;

    switch($a)
    {
    case $a%2==0;
    echo "even number";
    break;
    default:
    echo "odd number";
    break;
    }

    ReplyDelete
  10. Vowel Consonant Using Switch
    Shubham Nandwal

    $a='A';

    switch($a)
    {
    case 'a';
    echo "vowel";
    break;
    case 'e';
    echo "vowel";
    break;
    case 'i';
    echo "vowel";
    break;
    case 'o';
    echo "vowel";
    break;
    case 'u';
    echo "vowel";
    break;
    case 'A';
    echo "vowel";
    break;
    case 'E';
    echo "vowel";
    break;
    case 'I';
    echo "vowel";
    break;
    case 'O';
    echo "vowel";
    break;
    case 'U';
    echo "vowel";
    break;
    default:
    echo "consonant";
    break;

    ReplyDelete
  11. switch calculator
    Shubham Nandwal

    $n="/";
    $a=115;
    $b=100;
    switch($n)
    {
    case $n=="+";
    $x=$a+$b;
    echo "ADDITION OF TWO NUMBER IS = " .$x;
    break;
    case $n=="-";
    $x=$a-$b;
    echo "SUBTRACTIN OF TWO NUMBER IS = " .$x;
    break;
    case $n=="*";
    $x=$a*$b;
    echo "MULTIPLICATION OF TWO NUMBER IS = " .$x;
    break;
    case $n=="/";
    $x=$a/$b;
    echo "DIVISION OF TWO NUMBER IS = " .$x;
    break;
    default:
    echo "ENTER A VALID SYMBOL";
    break;
    }

    ReplyDelete
  12. $id = $_REQUEST['txt1'];
    $name = $_REQUEST['txt2'];
    $mobile = $_REQUEST['txt3'];
    $mail = $_REQUEST['txt4'];
    $conn= mysqli_connect('localhost','root','','prphp');
    $res= mysqli_query($conn,"insert into phptabl(id,name,mobile,email)
    value('$id','$name','$mobile','$mail')");
    if ($res>0)
    {
    echo "successfully";
    }
    else
    {
    echo "failed";
    }

    ReplyDelete
  13. ishu manglam
    Yes,NO and Cancel using switch

    $option = 'k';
    switch($option)
    {
    case 'y':
    echo "YES";
    break;

    case 'n':
    echo "NO";
    break;

    case 'c':
    echo "CANCEL";
    break;

    default:
    echo "INPUT IS WRONG";
    break;

    }

    ReplyDelete
  14. mohammad kabir



    $first=$_POST['txt1'];
    $second=$_POST['txt2'];
    $oprator=$_POST['submit'];
    $result='';
    if (is_numeric($first)&& is_numeric($second))
    {

    switch ($oprator)
    {
    case "add":
    $result=$first+$second;
    break;
    case "subtract":
    $result=$first-$second;
    break;
    case "multiply":
    $result=$first*$second;
    break;
    case "divid":
    $result=$first/$second;
    break;
    }
    }


    < action="" method="post">

    first number
    < type="number" name="txt2" placeholder="inter se number" value="">second number

    < readonly placeholder="see answer here" value="">result
    < type="submit" name="submit" value="add">
    < type="submit" name="submit" value="subtract">
    < type="submit" name="submit" value="multiply">
    < type="submit" name="submit" value="divid">


    ReplyDelete

Post a Comment

POST Answer of Questions and ASK to Doubt

Popular posts from this blog

Conditional Statement in Python

It is used to solve condition-based problems using if and else block-level statement. it provides a separate block for  if statement, else statement, and elif statement . elif statement is similar to elseif statement of C, C++ and Java languages. Type of Conditional Statement:- 1) Simple if:- We can write a single if statement also in python, it will execute when the condition is true. for example, One real-world problem is here?? we want to display the salary of employees when the salary will be above 10000 otherwise not displayed. Syntax:- if(condition):    statements The solution to the above problem sal = int(input("Enter salary")) if sal>10000:     print("Salary is "+str(sal)) Q)  WAP to increase the salary of employees from 500 if entered salary will be less than 10000 otherwise the same salaries will be displayed. Solution:- x = int(input("enter salary")) if x<10000:     x=x+500 print(x)   Q) WAP to display th...

DSA in C# | Data Structure and Algorithm using C#

  DSA in C# |  Data Structure and Algorithm using C#: Lecture 1: Introduction to Data Structures and Algorithms (1 Hour) 1.1 What are Data Structures? Data Structures are ways to store and organize data so it can be used efficiently. Think of data structures as containers that hold data in a specific format. Types of Data Structures: Primitive Data Structures : These are basic structures built into the language. Example: int , float , char , bool in C#. Example : csharp int age = 25;  // 'age' stores an integer value. bool isStudent = true;  // 'isStudent' stores a boolean value. Non-Primitive Data Structures : These are more complex and are built using primitive types. They are divided into: Linear : Arrays, Lists, Queues, Stacks (data is arranged in a sequence). Non-Linear : Trees, Graphs (data is connected in more complex ways). Example : // Array is a simple linear data structure int[] number...

Top 50 Most Asked MERN Stack Interview Questions and Answers for 2025

 Top 50 Most Asked MERN Stack Interview Questions and Answers for 2025 Now a days most of the IT Company asked NODE JS Question mostly in interview. I am creating this article to provide help to all MERN Stack developer , who is in doubt that which type of question can be asked in MERN Stack  then they can learn from this article. I am Shiva Gautam,  I have 15 Years of experience in Multiple IT Technology, I am Founder of Shiva Concept Solution Best Programming Institute with 100% Job placement guarantee. for more information visit  Shiva Concept Solution 1. What is the MERN Stack? Answer : MERN Stack is a full-stack JavaScript framework using MongoDB (database), Express.js (backend framework), React (frontend library), and Node.js (server runtime). It’s popular for building fast, scalable web apps with one language—JavaScript. 2. What is MongoDB, and why use it in MERN? Answer : MongoDB is a NoSQL database that stores data in flexible, JSON-like documents. It...