Re: alzheimers and confused

From: Date: Sat, 17 Nov 2001 05:39:28 +0000
Subject: Re: alzheimers and confused
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74966@lists.php.net to get a copy of this message
AND seems correct to me. If you want to generate an error when the file is not a jpeg file then the file name must not contain jpg AND must not contain jpeg. If either jpg OR jpeg is present then no error should occur. Be careful when using the !not operator with logical condition operators, the logic becomes more complex. Fred Jtjohnston <taylorjo@collegesherbrooke.qc.ca> wrote in message news:3BF5CF33.6CF87F85@collegesherbrooke.qc.ca... > OK kids, I'm not 19 ... my old brain gets tired easily and my wife is > complaining that I stay up too late PHPing :) > Putting the rest aside, why does AND work and not OR. OR was what I > meant? > I meant ... if the string doesn't contain .jpg or the string doesn't > contain .jpeg ... > ERROR! > > John > > <?php > $errorfound = 0; > $yourimage = > "http://callisto.si.usherb.ca/~ang96m04/cgi-bin/postcards/e.jpegstrie/sap_bu cket.jpg"; > > // if((!strpos($yourimage, ".jpg")) or (!strpos($yourimage, ".jpeg"))) > if((!strpos($yourimage, ".jpg")) and (!strpos($yourimage, ".jpeg"))) > { > $errorfound++; > echo"Your image \"<font > color=\"000000\">$yourimage</font>\"<br> did > not contain .jpg or .jpeg</b>"; > }else{ > echo"Your image \"<font > color=\"000000\">$yourimage</font>\" contains > .jpg or .jpeg</b>"; > } > > ?> > >

« previous php.general (#74966) next »