[UPHPU] More if then fun...

Kenneth Burgener email at kennethburgener.com
Wed Apr 28 12:11:19 MDT 2004

Looks like an order of operations problem...

if( false or false ) = false

if( true or (false and false) ) = true
*Remember ANDs get processed before ORs

The logic is correct for the output.  What are you trying to do?

-----Original Message-----
From: Ashley Oviatt [mailto:ashovi at qwest.net]
Sent: Wednesday, April 28, 2004 12:05 PM
Cc: UPHPU List
Subject: [UPHPU] More if then fun...

Can someone explain to me why the first if statement works (doesn't 
produce the output,) and the second one doesn't work (Does produce the 

I'm assuming the syntax of the second if statement is wrong, but I don't 
know why.

	$text = "";	
	$k = "Website";

// First if statement
	if ($k == "Websites" || $k == "Email_Address")
         if ($text !="")
		print "hello I am the first test";

//Second if statement.
	if ($k == "Website" || $k == "Email_Address" && $text !="")

		print "hello I am the second test";

The output of the code is : hello I am the second test


To unsubscribe, e-mail: list-unsubscribe at uphpu.org
For additional commands, e-mail: list-help at uphpu.org

More information about the UPHPU mailing list