Finding a smaller value and swap values in php
Posted
by user187580
on Stack Overflow
See other posts from Stack Overflow
or by user187580
Published on 2010-04-28T11:13:11Z
Indexed on
2010/04/28
11:23 UTC
Read the original article
Hit count: 124
Hi
$var1 = 22;
$var2 = 10;
echo $var1 = ($var1 < $var2) ? $var1 : $var2; //smaller var
echo '<br />';
echo $var2 = ($var1 > $var2) ? $var1 : $var2; //greater var
I expect it to print 10 and 22
but it prints 10 and 10
. any ideas what I am doing wrong?
Thanks
© Stack Overflow or respective owner