Q: Logical assignment with strstr( )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    $oLen = strlen ($commentary);
    $isSpam = ! strstr($_POST['Name']," ");
    $isSpam |=  strlen (str_replace("http://","",$commentary)) < $oLen;
    $isSpam |=  strstr($_POST['Name'],"@");
    $isSpam |=  stristr($_POST['Name'],"Casino");

//My next trial will be to add "is_string( ...)"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux