![]() |
Quick PHP Question.
I've got a check to see if it's a certain producttype (dog), and if so, something fits. Question is, can I have it be 'dog' and 'cat' and still have it as a line and not going into a if/else?
<-- Total noob, just learning. Thanks in advance and Happy New Year. PHP Code:
Code:
<?php if($this->product->productType == 'dog') { ?> ruff ruff ruff <?php } ?> |
Sorry, but I havent understood ur question.
I have a lousy english. But you have a variable set to be "dog" how can it be "dog" and "cat" at the same time? <?php if($this->product->productType == 'dog' or $this->product->productType == 'cat') { ?> |
Yes that is what I meant "OR".
If it is dog or cat. (could be both) I guess, bowls, toys, I don't know :) THANKS! |
if( item==dog or item==cat ){ do stuff }
|
Quote:
|
I'd start by seperating your scripting layer from you presentation layer.
Perhaps using a ''switch" could help you as well. Quote:
|
wtf ? am I missing something here :1orglaugh
Code:
if($this->product->productType == "dog" || $this->product->productType == "cat") { } || = OR && = AND I mean I wouldnt do it that way but that answer your question about and and or. |
Check PHP.net its full of examples
|
Quote:
|
All times are GMT -7. The time now is 07:36 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123