[PHP] strstr() question

2003-03-18 Thread Charles Kline
What is the expected return when using strtr() to compare a string to 
an empty string?

example:

$myval = strstr('bob', '');

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


Re: [PHP] strstr() question

2003-03-18 Thread Kevin Stone
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 18, 2003 12:50 PM
Subject: [PHP] strstr() question


 What is the expected return when using strtr() to compare a string to
 an empty string?

 example:

 $myval = strstr('bob', '');

 Thanks,
 Charles

I would susspect this would result in an error.  The parameter is expect a
non-empty string.
- Kevin



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



[PHP] strstr Question

2001-08-12 Thread Erich Zigler

I am currently writing a piece of code that when a user enters in their
email address it will check it for validity. 

In this instance they are supposed to type in [EMAIL PROTECTED] But if they
just type in user I want it to add @domain.com at the end by default. This
is the piece of code I have so far, but it does not seem to be working...

if (strstr($email, '@')) {
continue;
} else {
$email = $email . @domain.com;
}

I've been all over the documentation but I am obviously missing something.
If anyone could be of any assistance I would greatly appreciate it.

Thanks you.

-- 
Erich Zigler  

I prefer rogues to imbeciles, because they sometimes take a rest.
  -- Alexandre Dumas (fils)

-- 
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] strstr Question

2001-08-12 Thread Mark Maggelet

On Sun, 12 Aug 2001 18:42:48 -0500, Erich Zigler
([EMAIL PROTECTED]) wrote:
I am currently writing a piece of code that when a user enters in
their
email address it will check it for validity.

In this instance they are supposed to type in [EMAIL PROTECTED] But if
they
just type in user I want it to add @domain.com at the end by
default. This
is the piece of code I have so far, but it does not seem to be
working...

if (strstr($email, '@')) {
continue;
} else {
$email = $email . @domain.com;
}

I've been all over the documentation but I am obviously missing
something.
If anyone could be of any assistance I would greatly appreciate it.

continue is for loops, not if's. delete that line and it should work,
or better yet:

if (!strstr($email, '@')) $email.=@domain.com;





--
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]