php3-list | 199901
Date: 01/30/99
- Next message: Phil Harris: "Re: [PHP3] Help : Newby !!!!"
- Previous message: Thomas: "Re: [PHP3] Win32 Apache 1.3.3 & PHP3 installation"
- Maybe in reply to: ccunning <email protected>: "[PHP3] strstr"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] strstr"
- Reply: Rasmus Lerdorf: "Re: [PHP3] strstr"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 8:08 PM 1/30/99, ccunning <email protected> wrote:
>Maybe I have to use a regexp, but since the str functions are faster, I'm
>trying
>to use this. strstr() is supposed to return the rest of the string if an
>occurance is found, or false if it's not found. I did a
>
>if (!strstr("Re:", $string)) {
> $string = "Re: $string";
>}
>
>Which should add Re: before the string if it doesn't already contain Re:. But,
>when I try it, if string is "Re: some text", then it makes $string = "Re: Re:
>some text".
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:
if (is_int(strstr("Re:", $string)){
$string = 'Re:' . $string;
}
is what you want.
Hmmm. Would $string =. 'Re:'; turn into the above?... Or am I taking the
pre- and post-operators "logic" too far?...
-- "TANSTAAFL" Rich lynch <email protected> webmaster@ and www. all of:
R&B/jazz/blues/rock - jademaze.com music industry org - chatmusic.com
acoustic/funk/world-beat - astrakelly.com sculptures - olivierledoux.com
my own nascent company - l-i-e.com cool coffeehouse - uncommonground.com
-- 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>
- Next message: Phil Harris: "Re: [PHP3] Help : Newby !!!!"
- Previous message: Thomas: "Re: [PHP3] Win32 Apache 1.3.3 & PHP3 installation"
- Maybe in reply to: ccunning <email protected>: "[PHP3] strstr"
- Next in thread: Rasmus Lerdorf: "Re: [PHP3] strstr"
- Reply: Rasmus Lerdorf: "Re: [PHP3] strstr"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

