Or, as my teenage son, who is smarter than me, suggests ...
1 / $x + abs( $x )
which yields 1/0 if $x is neg. (He didn't go into trapping for the error
... sigh.)
Miles
At 11:07 PM 9/25/2002 -0300, Miles Thompson wrote:
>$x = -1;
>if ($x < 0 ){
> echo "Negative";
>else
>
$x = -1;
if ($x < 0 ){
echo "Negative";
else
echo "Positive";
}
Or am I missing something?
Miles
At 07:02 PM 9/25/2002 -0700, Mike Dunlop wrote:
>I've look through all the numerican functions but can't readily see a way
>to test for a negative number e.g -7
>
>Any ideas o
I've look through all the numerican functions but can't readily see a
way to test for a negative number e.g -7
Any ideas on how to do this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
3 matches
Mail list logo