At 13:38 30.11.2002, Beth Gore said:
--------------------[snip]--------------------

Add a "break" statement once you've detected binary, for optimization
(binary might be just some length...)

<?php
>function isbinary($input)
{
    /* This simple function returns true if there's any
       non-standard Ascii characters */

    $isbinary = 0;
    for($x=0;$x < strlen($input); $x++) {
        $c = substr($input,$x,1);
        if($c < chr(32) or $c > chr(127)) {
            /* add expected european extended characters */
            if($c != chr(10) or $c != chr(13) or $c != chr(9)) {
                $isbinary = 1;
/* >>> */      break;
            }
        }
    }
    return $isbinary;
}


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



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

Reply via email to