Re: one quick question: how do I assign atring value into variable?
| From: | David Robley | Date: | Thu, 01 Feb 2001 06:46:32 +0000 |
| Subject: | Re: one quick question: how do I assign atring value into variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-37606@lists.php.net to get a copy of this message | ||
On Fri, 2 Feb 2001 04:03, jacky@activelifestyle.com wrote:
> > Folks,
> The title is my question, how do I assign strign value into variables?
> Say , is the syntax below correct?
>
> if ($singleRooms==1) {
> $roomType ='Single Room';
> }elseif ($singleRooms==2) {
>
> }else{
> $roomType='Room Type not declared';
> }
Yup, the = is the assignment operator. You might like to take a look at
manual/en/language.operators.php at your favourite mirror for more
information on the various operators.
You could also do the above with a switch statement.
switch($singlerooms) {
case 1:
$roomType ='Single Room';
break;
case 2:
$roomType ='Double Room';
break;
......
}
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA