Simple - Change to if not (array).

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Simple - Change to if not (array).

Post by JAB Creations »

I currently have an array that looks for certain conditions. Right now if any of the conditions in the array are met the end part (below) executes. I would like to simply change it to do the opposite. If the condition is met I wish to not initially execute the script (to of course extend it with an else). I hope that makes sense! I've changed a couple things in my snippet (filler and $variable). I figure this should be easy enough though I've been banding my head trying to get this to work for a while now. Thanks for your help!

Code: Select all

if(in_array($_SERVER['filler'],$variable)){}
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Code: Select all

if(!in_array($_SERVER['filler'],$variable)){}
P.S. - your signature is !charming.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Post by JAB Creations »

Thank you very much!

It's !charming to have one's questions questioned all the time. It leads way off topic and in to some sort of political code related debate and since adding that to my signature the folks who have been kind enough to reply have been of great help (such as yourself). I suppose I could rephrase it though.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

When people are 'questioning your question', I'm guessing that they are really questioning the problem from which the question was derived, to help better solve that problem. I don't think anyone is here to antagonize.
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

aaronhall wrote:When people are 'questioning your question', I'm guessing that they are really questioning the problem from which the question was derived, to help better solve that problem. I don't think anyone is here to antagonize.
Agree. Sometimes you need to better understand a situation before applying a solution to it.
Post Reply