switch statement

From: Date: Thu, 17 Oct 2002 21:45:13 +0000
Subject: switch statement
Groups: php.general 
Request: Send a blank email to php-general+get-120407@lists.php.net to get a copy of this message
I am using a switch statement and want to have the user put in a car type and speed of the car then have the statement give it a variable $var which is a engine type. However, I want to minimize some of the work and have the car companies that have the same engine type be in an array. Is this possible. If so, what is wrong with my switch statement. switch ($carname AND $speed) { case $carname==BMW AND $speed==165: ($var= "8L"); break; case $carname==Mercedes AND $speed==150: ($var= "5L"); break; case $carname=array( "Ford", "Chevy", "Dodge" ) AND $speed==135: ($var= "6L"); break; default: ($var= "4L"); } Please help. Ben

« previous php.general (#120407) next »