lopes_andre Posted December 27, 2009 Share Posted December 27, 2009 Hi, How can I get this control working? function get_photo_thumb($type, $folder, $file){ if ($type <> ('detalhe' || 'zona') ) { return 0; // do notnhing. } else { switch ($type) { case "detalhe": $width = '200'; $height = '150'; break; case "zona": $width = '400'; $height = '300'; break; case "zonadestaque": $width = '500'; $height = '400'; break; } ..... ...... ..... } If I pass the parameter $type as 'zonadestaque' the control does not return 0. What can I do to get this working? Best Regards, Link to comment https://forums.phpfreaks.com/topic/186454-if-control-not-working-as-expected/ Share on other sites More sharing options...
wildteen88 Posted December 27, 2009 Share Posted December 27, 2009 This line is not right if ($type <> ('detalhe' || 'zona') ) { You cannot compare multiple values at once. The above should be written as if ($type != 'detalhe' || $type != 'zona' ) { What are you trying to achieve with the function? Link to comment https://forums.phpfreaks.com/topic/186454-if-control-not-working-as-expected/#findComment-984591 Share on other sites More sharing options...
lopes_andre Posted December 27, 2009 Author Share Posted December 27, 2009 Weird, if I do this, works if ($type != 'detalhe' && $type != 'zona' ) The function get the thumb of a picture, the parameter TYPE gives me the size of the image. What I need to control is the string TYPE, if is not "detalhe" or "zona", do nothing. Best Regards, Link to comment https://forums.phpfreaks.com/topic/186454-if-control-not-working-as-expected/#findComment-984593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.