RE: [PHP] if string contains

2005-09-29 Thread Rob Agar

hi John

> Me thinks that was what I used.
> http://ca.php.net/strstr
> http://ca.php.net/stristr
> http://ca.php.net/strpos
> What's the difference? 

the ones ending 'pos' just return an integer position.  The 'i' in these
string manipulation functions generally means that the function is
case-insensitive.

Rob

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



Re: [PHP] if string contains

2005-09-29 Thread John Taylor-Johnston

Me thinks that was what I used.
http://ca.php.net/strstr
http://ca.php.net/stristr
http://ca.php.net/strpos
What's the difference? Other than

   "*Note: * If you only want to determine if a particular needle
   occurs within haystack, use the faster and less memory intensive
   function *strpos()*
    instead."


Rob Agar wrote:


heh.  you perhaps remember the strstr function..?  :)

Rob

 


-Original Message-
From: John Taylor-Johnston 
[mailto:[EMAIL PROTECTED] 
Sent: Friday, 30 September 2005 2:26 PM

To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: [PHP] if string contains


Humour me. I knew how to do this. I want to parse 
$searchenquiry and see 
if it contains "searchenquiry=".

Good grief, sorry.
John

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

   




 



--
John Taylor-Johnston
-
"If it's not Open Source, it's Murphy's Law."

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064



Re: [PHP] if string contains

2005-09-29 Thread John Taylor-Johnston

Jasper Bryant-Greene wrote:


John Taylor-Johnston wrote:

Humour me. I knew how to do this. I want to parse $searchenquiry and 
see if it contains "searchenquiry=".



$yourAnswer = ( strpos( $searchenquiry, 'searchenquiry=' ) !== false );


Thanks,
John

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



Re: [PHP] if string contains

2005-09-29 Thread Jasper Bryant-Greene

John Taylor-Johnston wrote:
Humour me. I knew how to do this. I want to parse $searchenquiry and see 
if it contains "searchenquiry=".


$yourAnswer = ( strpos( $searchenquiry, 'searchenquiry=' ) !== false );

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



Re: [PHP] if string contains...

2001-05-06 Thread Gyozo Papp

$pos = strpos($varone, 'is')
if ($pos === false) { /*not found */ }
- Original Message - 
From: "Jamie Saunders" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 6. 16:58
Subject: [PHP] if string contains...


> Hi,
> 
> I want to check whether a string contains a certain word e.g.
> 
> $varOne = "this is a string";
> 
> if ($varOne contains "is") {
> 
>  return true;
> 
>  } else {
> 
>  return false;
> 
> }
> 
> Is there an operator for 'contains', if not how do you do this?
> 
> Thanks.
> 
> 
> Jamie Saunders
> Mail: [EMAIL PROTECTED]
> Web: http://jamie-s.co.uk
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] if string contains...

2001-05-06 Thread Alvin Tan

http://php.net/manual/en/function.strstr.php

$varOne = "is";
$varTwo = "this is a string";
if(strstr($varTwo,$varOne)) {
echo "true.";
} else {
echo "false.";
}

Regards,
@lvin

At 03:58 PM 5/6/01 +0100, Jamie Saunders wrote:
>Hi,
>
>I want to check whether a string contains a certain word e.g.
>
>$varOne = "this is a string";
>
>if ($varOne contains "is") {
>
> return true;
>
> } else {
>
> return false;
>
>}
>
>Is there an operator for 'contains', if not how do you do this?
>
>Thanks.
>
>
>Jamie Saunders
>Mail: [EMAIL PROTECTED]
>Web: http://jamie-s.co.uk
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]