if($ext == ('zip' || 'png')) { echo "Is it possible ?" }
you could use in_array($ext,array('png','zip','another','more'))
see here: http://php.net/manual/en/function.in-array.php
if($ext == ('zip' || 'png'))
is doing comparison in the following order -> ('zip' || 'png')
, which because at least one is not null, returns TRUE. Substitute that in now, ($ext == TRUE)
, which I'm going to go out on a limb and guess that php is just evaluating this the same as it would ($ext)
, which is also true.
if ( $ext == 'zip' || $ext == 'png' )
will check what you are looking for.
You could go with a switch-case statement:
switch($ext)
{
case 'png':
case 'zip':
// Will run for both 'png' and 'zip'
echo "It is possible";
break;
default:
echo "unknown extension!";
break;
}