PHP Get variable to equal value of switch
        Posted  
        
            by user342391
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user342391
        
        
        
        Published on 2010-05-23T14:03:23Z
        Indexed on 
            2010/05/23
            14:10 UTC
        
        
        Read the original article
        Hit count: 490
        
I am trying to get a variable on my page to equal the result of a switch I have.
This is the code:
$payment_method = switch ($cardtype) {
case "visa" : echo "VSA"; break;
case "mastercard" : echo "MSC"; break;
case "maestro" : echo "MAE"; break;
case "amex" : echo "AMX" ; break;
default : echo "Please specify a payment method!"; break;
};
How can I get $payment_method to equal the result of this????
So far I recieve an error:
Parse error: syntax error, unexpected T_SWITCH in /var/www/account/credits/moneybookers/process.php on line 65
© Stack Overflow or respective owner