I'd suggest a tutorial or something on BOOLEAN or LOGICAL OPERATORS.
For example:
true and false = false
true or false = true
not true and not false = false
not true or not false = true
and so on...
The IF statement will simply take the result of a logical operation,
and the result will either be
On Thu, 2007-10-18 at 19:57 -0500, ron.php wrote:
> I just tried to send this to the list. I am not trying make it post again, I
> don't think I had the e-mail address correct the first time.
>
> I am trying to stop $component_reference from doing the echo below when the
> value is 5 or 19. I
just change OR by AND.
2007/10/19, ron.php <[EMAIL PROTECTED]>:
> I just tried to send this to the list. I am not trying make it post again, I
> don't think I had the e-mail address correct the first time.
>
> I am trying to stop $component_reference from doing the echo below when the
> value is
Jason Pruim wrote:
On Jun 21, 2007, at 1:58 PM, Roberto Mansfield wrote:
Jason Pruim wrote:
It's not quite making sense to me though... My understanding of IF
statements is if the condition is met it ignores all the other if's. Is
that not correct? At this point it's just me trying to figure
On Jun 21, 2007, at 1:58 PM, Roberto Mansfield wrote:
Jason Pruim wrote:
It's not quite making sense to me though... My understanding of IF
statements is if the condition is met it ignores all the other
if's. Is
that not correct? At this point it's just me trying to figure
things out
for
Jason Pruim wrote:
>
> It's not quite making sense to me though... My understanding of IF
> statements is if the condition is met it ignores all the other if's. Is
> that not correct? At this point it's just me trying to figure things out
> for my knowledge :)
No, that's not how it works. If the
On Jun 21, 2007, at 1:42 PM, Roberto Mansfield wrote:
Jason Pruim wrote:
The code I had worked out, originally was something along the
lines of:
if($row[5] =="Level1") (
echo "$row[0] ";
echo "$row[1] ";
echo "InstructionsA>";
echo "Click here!";
}
if($row[5] =="Level2"){
Jason Pruim wrote:
>
>
> The code I had worked out, originally was something along the lines of:
>
> if($row[5] =="Level1") (
> echo "$row[0] ";
> echo "$row[1] ";
> echo "Instructions";
> echo " href='update.php?taskid=$row[0]'>Click here!";
> }
>
> if($row[5] =="Level2"){
> e
On 6/20/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
Hey Jim,
You're right it is the system you helped me get started with, Just
wanted to add a little color coding for the different levels :)
Here is the sql query:
$sql = "SELECT * FROM tasks WHERE completed='0' order by id";
$sql .= " AND (da
On Jun 20, 2007, at 10:56 AM, Daniel Brown wrote:
On 6/20/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
I would look at your result set and see if you had multiple lines
returned. One person mentioned that you might be using a JOIN in you
SQL call. This could lead to multiple lines.
Start invest
On 6/20/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
I would look at your result set and see if you had multiple lines
returned. One person mentioned that you might be using a JOIN in you
SQL call. This could lead to multiple lines.
Start investigating your SQL statement I would suggest.
Actu
Jason Pruim wrote:
On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote:
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would my
if statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
echo "$row[0] ";
On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote:
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would
my if statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
echo "$row[0] ";
echo "$row[1
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would my if
statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
echo "$row[0] ";
echo "$row[1] ";
echo "='$row[2]'>Instructions";
On 9/8/06, Robert Cummings <[EMAIL PROTECTED]> wrote:
On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote:
> Well, it could be this, too:
>
> switch( $_REQUEST['id'] ) {
> case "white":
> echo "Right color.";
> break;
>
> case "black":
> echo "Rig
At 12:29 PM -0400 9/9/06, Robert Cummings wrote:
On Sat, 2006-09-09 at 12:12 -0400, Mark Charette wrote:
As a senior member of the software QC department in a major industrial
company, I generally find more errors and omissions in validation
routines during code reviews and ethical hacks tha
On Sat, 2006-09-09 at 17:27 +0100, Stut wrote:
> Mark Charette wrote:
> > And I'll wager a brew no one here has ever done a formal, mathematically
> > rigorous proof of a validation routine except as a class project. As a
> > senior member of the software QC department in a major industrial
> >
On Sat, 2006-09-09 at 12:12 -0400, Mark Charette wrote:
>
> As a senior member of the software QC department in a major industrial
> company, I generally find more errors and omissions in validation
> routines during code reviews and ethical hacks than anywhere else.
http://en.wikipedia.org/wiki
Mark Charette wrote:
And I'll wager a brew no one here has ever done a formal, mathematically
rigorous proof of a validation routine except as a class project. As a
senior member of the software QC department in a major industrial
company, I generally find more errors and omissions in validatio
Robert Cummings wrote:
On Sat, 2006-09-09 at 11:30 -0400, Mark Charette wrote:
Stut wrote:
Mark Charette wrote:
However, looking at it from a 'knowing early the data is tainted'
perspective, not from a 'validating and cleaning perspective', if you
have coded that (for instance)
On Sat, 2006-09-09 at 11:30 -0400, Mark Charette wrote:
> Stut wrote:
> > Mark Charette wrote:
> >> However, looking at it from a 'knowing early the data is tainted'
> >> perspective, not from a 'validating and cleaning perspective', if you
> >> have coded that (for instance) a variable is set vi
Stut wrote:
Mark Charette wrote:
However, looking at it from a 'knowing early the data is tainted'
perspective, not from a 'validating and cleaning perspective', if you
have coded that (for instance) a variable is set via COOKIE, then
only looking for that variable set via COOKIE will eliminat
On Sat, 2006-09-09 at 10:21 -0400, Mark Charette wrote:
> Robert Cummings wrote:
> > On Fri, 2006-09-08 at 18:38 -0400, tedd wrote:
> >
> >> At 5:03 PM -0400 9/8/06, JD wrote:
> >>
> >> In all of the answers given thus far, no one mentioned that the use
> >> of $_REQUEST has a security iss
Mark Charette wrote:
However, looking at it from a 'knowing early the data is tainted'
perspective, not from a 'validating and cleaning perspective', if you
have coded that (for instance) a variable is set via COOKIE, then only
looking for that variable set via COOKIE will eliminate its being
Robert Cummings wrote:
On Fri, 2006-09-08 at 18:38 -0400, tedd wrote:
At 5:03 PM -0400 9/8/06, JD wrote:
In all of the answers given thus far, no one mentioned that the use
of $_REQUEST has a security issue with regard to where the $_REQUEST
originated.
$_REQUEST is an array consisti
side down.
Satyam
- Original Message -
From: "Kevin Murphy" <[EMAIL PROTECTED]>
To: "php"
Cc: "JD" <[EMAIL PROTECTED]>
Sent: Friday, September 08, 2006 11:25 PM
Subject: Re: [PHP] if statement with or comparison (newbie)
Shouldn't that be
On Fri, 2006-09-08 at 18:38 -0400, tedd wrote:
> At 5:03 PM -0400 9/8/06, JD wrote:
> >I'm trying to set up a simple conditional, something like this:
> >
> >Here is what I have tried:
> >
> > if ($_REQUEST['id'] != ("black" or "white")) {
>
>
> In all of the answers given thus far, no one me
At 5:03 PM -0400 9/8/06, JD wrote:
I'm trying to set up a simple conditional, something like this:
Here is what I have tried:
if ($_REQUEST['id'] != ("black" or "white")) {
In all of the answers given thus far, no one mentioned that the use
of $_REQUEST has a security issue with regard
On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote:
> Well, it could be this, too:
>
> switch( $_REQUEST['id'] ) {
> case "white":
> echo "Right color.";
> break;
>
> case "black":
> echo "Right color.";
> break;
>
> default:
>
At 05:30 PM 9/8/2006, you wrote:
- Original Message - From: "JD" <[EMAIL PROTECTED]>
To:
Sent: Friday, September 08, 2006 11:03 PM
Subject: [PHP] if statement with or comparison (newbie)
I'm trying to set up a simple conditional, something like this:
If my_variable is NOT equal to (
- Original Message -
From: "JD" <[EMAIL PROTECTED]>
To:
Sent: Friday, September 08, 2006 11:03 PM
Subject: [PHP] if statement with or comparison (newbie)
I'm trying to set up a simple conditional, something like this:
If my_variable is NOT equal to (black or white)
echo "wrong c
ED]
Sent: Friday, September 08, 2006 3:26 PM
To: php
Cc: JD
Subject: Re: [PHP] if statement with or comparison (newbie)
Shouldn't that be this instead:
if (($_REQUEST['id'] != "black") OR ($_REQUEST['id'] !=
"white")) {
echo "w
I think the OR should be an AND ...
If $_REQUEST['id'] = "black" then the second test will be true and it
will output "wrong color." If the color is "white" then the same thing
will happen 'cause it meets the first criteria.
-- Mitch
Kevin Murphy wrote:
Shouldn't that be this instead:
Shouldn't that be this instead:
if (($_REQUEST['id'] != "black") OR ($_REQUEST['id'] !=
"white")) {
echo "wrong color";
} else {
echo "right color";
}
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc
Let me rephrase it. Your color should be black or white to be the right
colour. Is this correct?
In that case you should change it to
if ($_REQUEST['id'] != "black" AND $_REQUEST['id'] != "white") {
echo "wrong color";
} else (
echo "right color";
}
- Or
On Mon, June 26, 2006 1:23 pm, Robert Cummings wrote:
> I can't think of any language that processes the contents of a
> conditional block when the test condition fails.
I believe that PHP with Runkit would let you set that up to happen, if
it was something you actually wanted... :-)
And Common L
On Monday 26 June 2006 13:10, Alex Major wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get executed if $number = 0 ?
>
> If
On Mon, 2006-06-26 at 14:10, Alex Major wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get executed if $number = 0 ?
>
> If
On Mon, 26 Jun 2006 19:10:59 +0100, Alex Major <[EMAIL PROTECTED]> wrote:
> Hi list.
> Basically, I'm still learning new things about php and I was wondering if
> things inside an if statement get 'looked at' by a script if the condition
> is false.
> For example, would this mysql query get execut
On 03 November 2005 15:26, Brent Baisley wrote:
> You only need one "if". The parenthesis will evaluation order.
>
> if( ( !empty( $var1 ) || ( !empty( $var2 ) && !empty( $var3 ) ) ||
> $var1 == "something" )
However, the $var1=="something" test is redundant in this, since if that is
true th
You only need one "if". The parenthesis will evaluation order.
if( ( !empty( $var1 ) || ( !empty( $var2 ) && !empty( $var3 ) ) ||
$var1 == "something" )
On Nov 3, 2005, at 10:13 AM, Jason Gerfen wrote:
I am trying to determine if it is worth my time to attempt a if
statement similar to t
TheI2eptile wrote:
Probably this is the wrong place to put this but I couldn't search for
not at all the wrong place, having said that the only thing probable with
regard
to you/your post is that you are not fully aware of the nature of data types in
php and the way auto-typecasting works (in ter
Hello TheI2eptile,
Thursday, March 24, 2005, 2:05:14 PM, you wrote:
T> So here is what I would call a bug, but maybe it's thought to be so:
Try it with strict (data-type) comparisons, i.e.:
if ($var === "AS")
Then you won't get the "bug".
Best regards,
Richard Davey
--
http://www.launchcod
* Thus wrote Jay Blanchard ([EMAIL PROTECTED]):
> [snip]
> strpos() : 0.19018315076828
> preg_match() : 0.26157474517822
> in_array() : 0.26403407096863
> [/snip]
>
> Very interesting...thanks!
>
So if we're not going to search though a string 10,000 times you'll
save ~0.07139159440994 secon
[snip]
strpos() : 0.19018315076828
preg_match() : 0.26157474517822
in_array() : 0.26403407096863
[/snip]
Very interesting...thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
John Nichel wrote:
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to a
Jay Blanchard wrote:
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then us
Jay Blanchard wrote:
> [snip]
> strpos() : 0.18918436765671
> preg_match() : 0.26665662288666
> [/snip]
>
> 1/3rd of a second slowerinteresting. You know what though, my
> original assertion is correctalmost any of the regex functions
> will work.
Personally, I prefer using preg_match() 9
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 19 May 2004 15:47
>
> If I'm being Dumb, I apologies...
> but When using this:
>
> $row[bands] = "1,2,3,4,5,6,7,8";
> $row2[id] = "7";
> if (strpos($row[bands], $row2[id]) != FALSE) {
> // do stuf
[snip]
strpos() : 0.18918436765671
preg_match() : 0.26665662288666
[/snip]
1/3rd of a second slowerinteresting. You know what though, my
original assertion is correctalmost any of the regex functions will
work.
Tristan, why not convert the string to an array and then use in_array()?
John,
Curt Zirzow wrote:
Make sure your benchmarks aren't bias:
- assignment takes time
- concating string takes time
strpos($haystack,$needle);
v.s.
preg_match($regex,$haystack);
Just for shits and giggles (and because it's a slow work day), the below
script output this...
strpos() : 0.18918
[snip]
If I'm being Dumb, I apologies...
but When using this:
$row[bands] = "1,2,3,4,5,6,7,8";
$row2[id] = "7";
if (strpos($row[bands], $row2[id]) != FALSE) {
// do stuff
}
[/snip]
What is the expected output?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http:
re that it should work, as it's not returning a false value...
But I'm still not getting the correct output on my page...
Any other ideas?
Oliver Hankeln <[EMAIL PROTECTED]>
19/05/2004 15:49
To
[EMAIL PROTECTED]
cc
Subject
Re: [PHP] IF statement question...
Curt Z
Curt Zirzow wrote:
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
10 Searches in a rather small string took
0.38s with strpos() and 0.55s with preg_match()
Make sure your benchmarks aren't bias:
- assignment takes time
- concating string takes time
You are right. I updated the script to
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
> Jay Blanchard wrote:
>
> >[snip]
> >Tipp: Do not use preg_match() if you only want to check if one string
> >is contained in another string. Use strpos() or strstr() instead as they
> >
> >will be faster.
> >[/snip]
> >
> >
> >This brings up a g
Jay Blanchard wrote:
[snip]
Tipp: Do not use preg_match() if you only want to check if one string
is contained in another string. Use strpos() or strstr() instead as they
will be faster.
[/snip]
This brings up a good point. Just exactly how much faster would one be
over another in this small exa
[snip]
Tipp: Do not use preg_match() if you only want to check if one string
is contained in another string. Use strpos() or strstr() instead as they
will be faster.
[/snip]
This brings up a good point. Just exactly how much faster would one be
over another in this small example? How big would
Jay Blanchard wrote:
[snip]
Is it possible to request that a string CONTAINS another string...?
EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
[/snip]
Almost any regex function would work here, for instance
$string = "1, 2, 3, 7, 8, 9";
if (preg_match("/7/", $st
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: 19 May 2004 12:55
>
> Is it possible to request that a string CONTAINS another string...?
>
> EG:
> $string = "1, 2, 3, 7, 8, 9";
> if ($string CONTAINS "7") {
> // Do stuff
> }
if (strpos($st
[EMAIL PROTECTED] wrote:
Is it possible to request that a string CONTAINS another string...?
EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
int strpos ( string haystack, string needle [, int offset])
is what you are looking for.
HTH,
Oliver Hankeln
--
PHP Genera
[snip]
Is it possible to request that a string CONTAINS another string...?
EG:
$string = "1, 2, 3, 7, 8, 9";
if ($string CONTAINS "7") {
// Do stuff
}
[/snip]
Almost any regex function would work here, for instance
$string = "1, 2, 3, 7, 8, 9";
if (preg_match("/7/", $string)){ //evaluate
To Brad, Marek and Curt (and anybody who responds after this)
Thank you so much for your help. This is going to help me out so
much in a lot of my scripts. It will sure make them a little.Noa
LOT more portable now.
Thanks
Steve
At 11:26 AM 9/30/2003, you wrote:
Steve Buehler wr
* Thus wrote Steve Buehler ([EMAIL PROTECTED]):
>
> What I would like to do is to have an array earlier in the script of just
> the items that it is checking for so that it can be more easily changed if
> I put this out as free or shareware software. Here is what it might look
> like, but I kn
if(in_array($k2b, $array)) { ...
Steve Buehler wrote:
I have an "if" statement that I would like to make a little bit more
generic. This is how the statement looks now.
if($k2b=="/etc/bind/options.conf.wp" || $k2b=="/etc/bind/rndc.conf.wp"
|| $k2b=="/etc/bind/keys.conf.wp"){
do this1
}els
Steve Buehler wrote:
[snip]
$array=("/etc/bind/options.conf.wp","/etc/bind/rndc.conf.wp","/etc/bind/keys.conf.wp");
if($k2b==$array){
do this1
}else{
do this2
}
You are close. Check out in_array(). http://us4.php.net/in_array
if (in_array($kb2, $array))
- Brad
--
PHP General Mailing
Thank you (all who resonded)!!! It makes sense now.
Now I can wait until 5:00pm, quitting time, to go crazy!!
James
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:23 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] IF statement madness
> -Original Message-
> From: James E Hicks III [mailto:[EMAIL PROTECTED]
> Sent: 14 March 2003 18:22
>
> Help save my sanity! What can I do to the IF statement in the
> following code to
> make it print the line that says "By God they are equal in
> value."? I have tried
> the following
What happens if you change $target to 216.0?
-- jon
-Original Message-
From: James E Hicks III [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] IF statement madness
Help save my sanity! What can I do to the IF statement in the f
At 19:21 14.03.2003, James E Hicks III said:
[snip]
>Help save my sanity! What can I do to the IF statement in the following
>code to
>make it print the line that says "By God they are equal in value."? I have
>tried
>the following changes;
>
> 1. usin
Comparing a float with an integer can have problems. You could try something
like:
if(abs($i - $target) < .1) {
//then they are essentially equal
}
Kirk
> -Original Message-
> From: James E Hicks III [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 14, 2003 11:22 AM
> To: [EMAIL PRO
--- Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote:
> >> >if ($lineone && $linetwo && $linethree && $linefour = "")
> >>
> >> Your expression yields true if 1-3 are not-empty AND four is an
> >> empty string.
> >
> > Actually, this expression yields true when $lineone, $linetwo,
and
> > $linethree
At 16:45 26.11.2002, Chris Shiflett spoke out and said:
[snip]
>--- Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote:
>
>> At 13:50 26.11.2002, [EMAIL PROTECTED] said:
>> >if ($lineone && $linetwo && $linethree && $linefour = "")
>>
>> Your expression yields tr
--- Jason Wong <[EMAIL PROTECTED]> wrote:
> At 13:50 26.11.2002, [EMAIL PROTECTED] said:
> >if ($lineone && $linetwo && $linethree && $linefour = "")
>
> Actually that expression will always be FALSE. $linefour = ""
> does not evaluate to TRUE thus the whole expression to be FALSE!
Yes, you're ri
On Tuesday 26 November 2002 23:45, Chris Shiflett wrote:
> --- Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote:
> > At 13:50 26.11.2002, [EMAIL PROTECTED] said:
> > >if ($lineone && $linetwo && $linethree && $linefour = "")
> >
> > Your expression yields true if 1-3 are not-empty AND four is an
> >
--- Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote:
> At 13:50 26.11.2002, [EMAIL PROTECTED] said:
> >if ($lineone && $linetwo && $linethree && $linefour = "")
>
> Your expression yields true if 1-3 are not-empty AND four is an
> empty string.
Actually, this expression yields true when $lineone,
Something like this will work...
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> The db will include these 4 rows even though they don't store data.
> Eventually they will contain data for contact info as soon as the users
> log in and it prompts them for i
The db will include these 4 rows even though they don't store data.
Eventually they will contain data for contact info as soon as the users
log in and it prompts them for it.
On Tue, 26 Nov 2002, DL Neil wrote:
> Ed,
> Assuming there will be a response from the db-tbl, here is another choice:
>
Ed,
Assuming there will be a response from the db-tbl, here is another choice:
if ( $lineone . $linetwo . $linethree . $linefour > "" )
{
//show it to the user and ask if they want to change it
}
else
{
//prompt for information
}
Do you mean that the db-tbl will have a row of data even if t
All four must be an empty string. I will be pulling the values from a
MySQL database. If these fields are empty I'll be prompting for
information. If any one of them contain anything I'll be showing it to
the user and asking if they want to change it.
Thanks,
Ed
On Tue, 26 Nov 2002, Ernest E
At 13:50 26.11.2002, [EMAIL PROTECTED] said:
[snip]
> I'll be trying to use a routine that checks 4 seperate variables for
>content and need to know the easiest method to do so. The function works
>on 2 conditions; either all the variables are empty and I do
You can do this:
if ($type == "test1" || $type == "test2" || $type == "test3") {
or, what I prefer in this case
if (in_array($type, array("test1", "test2", "test3"))) {
Martin
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 09, 2002 2:11 PM
To
On Tuesday 30 April 2002 12:36, baldey_uk wrote:
> Hello all,
>
> How can i force a transfer to another php page from an if statement?
>
> I have been trying:
>
> if (condition){
>
> echo "Link";
>
> }
> else {
>
> something else
> }
if (something) {
header("Location: http://www.somewhere.com";
Switch statements work well for these situations as well. They might be
faster than checking for the item in a list from an array since an array
must be created and searched through.
General programming tip: your method *definitely* wouldn't work. The or
operator has precendence over the == ope
something like:
If(in_array($ext, array("com", "net", "org", "info")){
//Then do this
}
If(in_array($ext, "com.uk", "me.uk", "org.uk")){
//Then do this
}
maybe??
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 4:22 PM
To: php-genera
From: Jeb Anderson Scarbrough <[EMAIL PROTECTED]>
Date: Thu, Sep 20, 2001 at 09:46:13AM -0400
Message-ID: <[EMAIL PROTECTED]>
Subject: [PHP] if statement
> This seems to be a simple questions, but it is baffling me for some reason.
> How do I create an if statement with multiple conditions. Fo
You need to use == instead of = in that situation.
- Tim
On Thu, 2001-09-20 at 09:46, Jeb Anderson Scarbrough wrote:
> This seems to be a simple questions, but it is baffling me for some reason.
> How do I create an if statement with multiple conditions. For example, I
> cannot get either of
So sprach »Brandon Orther« am 2001-08-30 um 08:59:44 -0700 :
> $var = "Hello".IF($var2 = 1) { ."Mr. Bean". } else { ."New Comer". }."
$var = "Hello" . (($var2 = 1)?("Mr. Bean"):("New Comer"));
But why do you assign 1 to $var2?
To circumvent these kind of problems, I always write:
$var = "Hello
From: * R&zE: <[EMAIL PROTECTED]>
Date: Thu, Aug 30, 2001 at 06:05:57PM +0200
Message-ID: <[EMAIL PROTECTED]>
Subject: Re: [PHP] If statement within a variable?
> This is it:
>
> $var = "Hello".($var2 = 1 ? "Mr. Bean" : "New Comer").&
Brandon Orther wrote:
>Hello,
>
>Is there a way to put an if statement in a variable?
>
>For example:
>
>$var = "Hello".IF($var2 = 1) { ."Mr. Bean". } else { ."New Comer". }."
>To The Coffee House.";
>
$var = "Hello ".($var2==1 ? "Mr. Bean" : "New Comer");
/franklin
--
PHP General Maili
From: Brandon Orther <[EMAIL PROTECTED]>
Date: Thu, Aug 30, 2001 at 08:59:44AM -0700
Message-ID: <006301c1316c$c9395010$0a00a8c0@webintel>
Subject: [PHP] If statement within a variable?
> Hello,
>
> Is there a way to put an if statement in a variable?
>
> For example:
>
> $var = "Hello".
$var = $var2==1 ? 'Hello Mr. Bean' : 'Hello New Comer';
be careful of your if statements and only using one equals..
jack
Brandon Orther wrote:
> Hello,
>
> Is there a way to put an if statement in a variable?
>
> For example:
>
> $var = "Hello".IF($var2 = 1) { ."Mr. Bean". } else { ."New Comer
$var="Hello".(($var==1)? "Mr. Bean":"New Comer")."To somewhere";
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS
- Original Message -
From: "Brandon Orther" <[EMAIL PROTECTED]>
To: "PHP User Group" <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2001 6:59 PM
S
You wrote:
> Is it possible to write this shorter:
>
> if ($Var != "No1" && $Var != "No2" && $Var != "No3") {
> code
> };
if(!ereg("^No[1-3]$", $Var)){
// code
}
--
-Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/
--
PHP General Mailing List (http://www.php.net/)
To
if(!preg_match("/^No[123]$/",$Var))
{
code
}
--
Darius Ivanauskas
On Wed, 29 Aug 2001, [iso-8859-1] Niklas Lampén wrote:
> Is it possible to write this shorter:
>
> if ($Var != "No1" && $Var != "No2" && $Var != "No3") {
> code
> };
>
>
> Niklas
>
--
PHP General Mailing List (http:/
94 matches
Mail list logo