"Dan McCullough" <[EMAIL PROTECTED]> wrote:
> Question.  I am trying to check to see if a certain piece of code should
be run.  Here is an
> example.
> if ($type != "add") || ($type != "edit") || ($type != "delete") {//if this
or this or this then
> then run this code

As pointed out, your paranthesis will give an error.  Also, || means OR and
I suspect you mean && which means AND.  Why?  Go through the logic and
you'll see that no matter what $type is, one of the 3 inequalities will be
true and since you use an || the entire if statement will evaluate to true.
Not what you want.

It might be easier to edit and follow your code if you rewrite as:

if ( ! in_array( $type, array( 'add', 'edit', 'delete' ) ) )
{
}

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.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]

Reply via email to