Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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";
}
Comment

php if negative make positive

<?php
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>
Comment

php if negative then 0

$value = -9;
echo max($value, 0); // Outputs '0'
Comment

PREVIOUS NEXT
Code Example
Php :: get woocommerce product category link by id 
Php :: php parse file 
Php :: curl get response headers php 
Php :: php date function get previous month 
Php :: Generating Random String In PHP Using uniqid() function 
Php :: filter validate email php 
Php :: php check if class exists 
Php :: check the ajax request in laravel 
Php :: laravel target class does not exist 
Php :: php extract last n words of string 
Php :: laravel migration table column nullable 
Php :: how validate the value of object in arraye in laravel 
Php :: laravel update return updated row, laravel update return 
Php :: find substring in string php 
Php :: laravel add attribute to model 
Php :: php convert to string 
Php :: laravel form request custom error message 
Php :: unique array 
Php :: Adding data to a laravel collection 
Php :: laravel grouping where 
Php :: sum of multidimensional array in php 
Php :: print array in php 
Php :: features of PHP7 
Php :: php superglobals 
Php :: show only 3 initial letter of month in php 
Php :: heredoc php 
Php :: php set status code 
Php :: laravel datepicker date format 
Php :: mac brew install php redis 
Php :: can we create linked list in php 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =