On Fri, 2007-02-23 at 12:24 +0100, rgx@xxxxxx wrote: > Dear list, > > strstr returns a string (in case the needle is found), > but a boolean if there is no needle in the haystack. > > I am trying to make a readable evaluation of some tests, but this fails > to work as supposed because of > - undefined results when "OR"ing strings with possible string (?) > - use of bitwise OR operator ("|") where I am uncertain if I can > write anything like $a ||= $b; > > Please read this snippet and tell me your ideas ;) > Thanks > Ralf > <?php $oLen = strlen( $commentary ); $isSpam = strstr( $_POST['Name'], ' ' ) === false; $isSpam |= strlen( str_replace( 'http://', '', $commentary ) ) < $oLen; $isSpam |= strstr( $_POST['Name'], '@' ) !== false; $isSpam |= stristr( $_POST['Name'], 'Casino' ) !== false; ?> Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php