switch statement in php urdu

how to use switch statement instead of "if else"
easy php tutorials in urdu
video tutorials

switch statement

 this is simple statement in programing :
example:

like you go to some market and you want to buy Fruit
rates are
apple  120/kg
mango 80/kg
banana 90/kg
orange  150/kg
so these are rates of fruit:ok so will decide which one you want to buy!!!

in programming i will write this in code
MONEY is what you have in your pocket !!!
you can change variable $money value to see the case affects

[code]
 <?php

$money =120; //this is a variable of MONEY like you have 120 rupees

switch($money)

{
case '120':echo "you want to buy apple";
break;
case '90':echo "you want to buy banana";
break;
case '80':echo "you want to buy mango";
break;
case '150':echo "you want to buy orange";
break;

}
?>


[code]

0 comments: