User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » php OR fail Page [1]  
Novicane
All American
15413 Posts
user info
edit post

I thought you could do this in php


if ($state == "WA" ||"MT" || "OR" || ID" ||"WY" || "CA" || "NV" || "UT" || "CO" || "AZ" || "NM"){
//west coast bitches!!!
}else{
//east coast bitch!!!
}


I went with this long ass shit instead:


if ($state == "WA" || $state == "MT" || $state == "OR" || $state == "ID" || $state == "WY" || $state == "CA" || $state == "NV" || $state == "UT" || $state == "CO" || $state == "AZ" || $state == "NM"){


is this the only way?

9/29/2009 4:44:35 PM

Stein
All American
19842 Posts
user info
edit post

Well, you could use an array or a regular expression.

9/29/2009 4:47:05 PM

qntmfred
retired
40551 Posts
user info
edit post

yeah i'd do an array

9/29/2009 4:49:21 PM

Golovko
All American
27023 Posts
user info
edit post

I'd go with array as well.

9/29/2009 4:51:03 PM

gs7
All American
2354 Posts
user info
edit post

Use an array, please.

Out of curiousity, I googled the logical phrase "php if multiple conditions".

http://www.google.com/#hl=en&q=php+if+multiple+conditions

First result:

http://bytes.com/topic/php/answers/6591-checking-multiple-conditions-one-variable

9/29/2009 4:56:43 PM

Novicane
All American
15413 Posts
user info
edit post

an array it is

9/29/2009 4:59:05 PM

BigMan157
no u
103352 Posts
user info
edit post

oh in_array() function, how i love you

9/29/2009 5:08:32 PM

evan
All American
27701 Posts
user info
edit post

i think you should use an array

9/30/2009 5:58:43 PM

Shaggy
All American
17820 Posts
user info
edit post

all languages that start with p are shit

9/30/2009 6:08:24 PM

smoothcrim
Universal Magnetic!
18954 Posts
user info
edit post

python > most

9/30/2009 6:08:54 PM

evan
All American
27701 Posts
user info
edit post

all languages with recursive acronyms in their names are awesome

9/30/2009 6:16:19 PM

Smath74
All American
93277 Posts
user info
edit post

i'd go with an array.

9/30/2009 7:58:06 PM

Specter
All American
6575 Posts
user info
edit post

use a hash table

10/1/2009 7:25:43 PM

spöokyjon

18617 Posts
user info
edit post

Generate a captcha that people have to solve to get onto your free porn website.

10/1/2009 7:49:29 PM

philihp
All American
8349 Posts
user info
edit post

clearly the best thing to do in this situation would be to setup an Oracle database to store a table of states, along with their full name, the date they were accepted into the union, and all possible zip codes within the state. Have a flag for those on the left coast, and those on the right. Then open up a pooled database connection, issue a query using the SQL "IN" syntax, and evaluate the results.

10/4/2009 1:00:52 AM

 Message Boards » Tech Talk » php OR fail Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.