check if number is negative or positive php code example
Example 1: php if negative make positive
<?php
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>
Example 2: check number is positive or negative in php
if($number > 0){
echo "the number is positive";
}
elseif($number < 0){
echo "the number is negative";
}
else{
echo "the number is zero";
}