Re: newbie: a very simple question (I hope)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 15 Dec 2004 10:23:29 -0800 (PST)
Patrick Roane <fojomo@xxxxxxxxxxxxx> wrote:

> I am trying some excercises in a book and one of the
> excercises says to:
> 
> Assign values to two variables. Use comparison
> operators to test whether the first value is:
> 
> 1. the same as the second
> 
> 2. less than the second
> 
> 3. Print the result of each test to the browser.
> 
> My question is, how do I print the result? For
> example, say I use the following expression:
> 
> $x = 3;
> ++$x < 4; // false
> print $x;
> 
> I know how to print out the value of $x, but not the
> test result of 'true or false'.  
> 
> Thanks-
> 

Wrap it in an 'if'

$x = 3;
if (++$x < 4) {
	echo 'result is true';
} else {
	echo 'result is false';
}

echo and print are largely interchangable

Michael

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux