cgm225 Posted February 18, 2008 Share Posted February 18, 2008 Is there a better way to write this statement to make it shorter? if(($file_extension == "jpg") OR ($file_extension == "JPG")) {} Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2008 Share Posted February 18, 2008 You can use in_array() <?php $exts = array('jpg','JPG'); if (in_array($file_extension,$exts)) echo 'Ok'; ?> or strtolower() <?php if (strtolower($file_extension) == 'jpg') echo 'Ok'; ?> Ken Quote Link to comment Share on other sites More sharing options...
phpSensei Posted February 18, 2008 Share Posted February 18, 2008 try in_array edit: nvm Quote Link to comment 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.