Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] strstr From: ccunning <email protected>
Date: 01/30/99

Quoting Richard Lynch <lynch <email protected>>:

> But remember that PHP uses 0-based arrays. You need to check the return
> *type* of strstr to distinguish between 0 and false. false is shorthand
> for '', a string. (I think.) I *know* that:
>

It shouldn't really matter though. Whatever it uses for false,

if(!some_condition) {
        do stuff;
}

stuff should always be done if some_condition is false, regardless of how php
represents false.

> if (is_int(strstr("Re:", $string)){
> $string = 'Re:' . $string;
> }
>
> is what you want.
>

Nope, that didn't add Re: to anything whether it had it or not. The following
also did not work.

if (strstr("Re:",$string) == "") {
        $string = "Re: " . $string;
}

and

if (strstr("Re:",$string) == 0) {
        $string = "Re: " . $string;
}

Both of the above stick a Re: in front of everything regardless...

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>