gevo12321 Posted December 12, 2008 Share Posted December 12, 2008 so i was wondering if the if statement and the else if statement can be about different variables. for example can i say if the room is green then something, else if the chair is green, then something, else something else. so for the if and else if, do they both have to be the room, or both have to be the chair or can they be different variables? Quote Link to comment https://forums.phpfreaks.com/topic/136714-solved-elseif/ Share on other sites More sharing options...
mmarif4u Posted December 12, 2008 Share Posted December 12, 2008 Can you explain more clearly. thanks Quote Link to comment https://forums.phpfreaks.com/topic/136714-solved-elseif/#findComment-713912 Share on other sites More sharing options...
gevans Posted December 12, 2008 Share Posted December 12, 2008 you can do whatever you want with them $chair = 'blue'; $floor = 'red'; $tv = 'green'; if($chair == 'green'){ echo 'chair is green'; }elseif($floor == 'green'){ echo 'floor is green'; }elseif($tv == 'green'){ echo 'tv is green'; }else{ echo 'nothing is green'; } Quote Link to comment https://forums.phpfreaks.com/topic/136714-solved-elseif/#findComment-713916 Share on other sites More sharing options...
gevo12321 Posted December 12, 2008 Author Share Posted December 12, 2008 oh ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/136714-solved-elseif/#findComment-713917 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.