[PHP] char function

2002-06-25 Thread Leo

i want a logical function (true or false) that search a character into a
string.(like indexOf() in javascript)
example: i want to find char '@ ' in the string [EMAIL PROTECTED]

leo



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




Re: [PHP] char function

2002-06-25 Thread Erik Price


On Tuesday, June 25, 2002, at 06:23  AM, Leo wrote:

 i want a logical function (true or false) that search a character into a
 string.(like indexOf() in javascript)
 example: i want to find char '@ ' in the string [EMAIL PROTECTED]

$str = '[EMAIL PROTECTED]';
if (preg_match('/@/', $str)) {
print $str does contain the '@' symbol.\n;
}

Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] char function

2002-06-25 Thread Evan Nemerson

php.net/strstr

Will return the string instead of true, but it will probably work for whatever 
you want to do...

if ( strstr($string1, $string2) )

works perfectly well





On Tuesday 25 June 2002 03:23 am, Leo wrote:
 i want a logical function (true or false) that search a character into a
 string.(like indexOf() in javascript)
 example: i want to find char '@ ' in the string [EMAIL PROTECTED]

 leo

-- 
To Believe without evidence and demonstration is an act of ignorance and 
folly.

Volney


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