jeudi 25 février 2016

How can I make functional 'if' statement

if ($variable=="x") {  
    $xs = 10;
}

if ($variable=="y") {
    $xy = 12;
}

I want to make functional if statement. Can I make this with loop instead of one by one?

How can I form this, like:

if $variable = a(0.) , b(1.) , c(2.) , d(3.) , e(4.) )  
$variables=(n+1)*7

Example:

if $variable = a  
n=0  
$variables=7

Example:

if $variable=d  
n=3  
$variables = 28

Aucun commentaire:

Enregistrer un commentaire