Re: What's wrong w/ this line?
| From: | Peter Janett | Date: | Tue, 26 Feb 2002 06:59:23 +0000 |
| Subject: | Re: What's wrong w/ this line? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86196@lists.php.net to get a copy of this message | ||
I'm guessing it's out of context. It must be after an if block, and before
and else block:
if ($value) {
print "some stuff is true";
}
elseif(!(preg_match("/^[A-Za-z0-9-]+$/",$uname))) {
print "$uname is valid";
}
else {
print "$uname is not valid";
}
-----------------------------
If is the "if", else is the "if not". If there is "if" and multiple
"ors",
then all but the last "or" is elseif.
"If a is red":
if ($a == "red"){
print "you chose red";
}
else {
print "you did not choose red";
}
-------------------------------------
"If a is red, or blue, or green, or yellow":
if ($a == "red"){
print "you chose red";
}
elseif ($a == "blue"){
print "you chose blue";
}
elseif ($a == "green"){
print "you chose green";
}
elseif ($a == "yellow"){
print "you chose yellow";
}
else{
print "you did not chose red, blue, green, or yellow";
}
HTH,
Peter Janett
New Media One Web Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.0.6, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PostgreSQL coming soon!
http://www.newmediaone.net
webmaster@newmediaone.net
(303)828-9882
----- Original Message -----
From: "Jason Cox" <jason@darkpenguin.com>
To: "Nick Richardson" <esoteric.web@gte.net>
Cc: <php-general@lists.php.net>
Sent: Monday, February 25, 2002 11:19 PM
Subject: Re: [PHP] What's wrong w/ this line?
> Nick,
>
> I believe you need a space between 'else' and 'if'. Should be two
separate
> words. If that doesn't work, please send more of the code.
>
> Regards,
> Jason Cox
>
> ----- Original Message -----
> From: "Nick Richardson" <esoteric.web@gte.net>
> To: "PHP General" <php-general@lists.php.net>
> Sent: Monday, February 25, 2002 11:04 PM
> Subject: [PHP] What's wrong w/ this line?
>
>
> > PHP seems to be completly ignoring this line...
> >
> > Funny part is that i use this same line in another place in my code and
it
> > works fine there... i have no clue - Need coffee.
> >
> > } elseif(!(preg_match("/^[A-Za-z0-9-]+$/",$uname))) {
> >
> > //Nick Richardson
> > //esoteric.web@gte.net
> > //webmaster@moderngarage.com
> > --------------------------------------------------------------
> > -- We must come to see that the end we seek, is a society --
> > -- at peace with itself. A society that can live with its --
> > -- concience. That will be a day not of the white man, not --
> > -- of the black man... That will be the day of man, as man! --
> > -- -Dr. Martin Luther King Jr. --
> > -- -March 25th, 1965 --
> > --------------------------------------------------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>