Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if($ext == ('zip' || 'png')) { echo "Is it possible ?" }

I'm currently writing sort of a download manager and I was asking myself if that was possible:

if($ext == ('zip' || 'png')) { echo "Is it possible ?" }

It returns true everytime, so I guess it's not possible. But do you have an idea about how I could easily do this ? I mean, not with plenty of "if" or "switch"...

Thanks anyway ! :)

like image 921
Minishlink Avatar asked Jan 24 '10 15:01

Minishlink


1 Answers

you could use in_array($ext,array('png','zip','another','more'))

see here: http://php.net/manual/en/function.in-array.php

like image 169
Adam Kiss Avatar answered Sep 18 '22 15:09

Adam Kiss