Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php number positive

<?php
echo abs(-4.2); // 4.2 (double/nombre à virgule flottante)
echo abs(5);    // 5 (entier)
echo abs(-5);   // 5 (entier)
?>
Comment

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

PREVIOUS NEXT
Code Example
Php :: laravel show debug query sql 
Php :: laravel get single column value 
Php :: php program to find factorial of a number using function 
Php :: migrate specific migration file laravel 
Php :: php array has key 
Php :: laravel fixed character limit 
Php :: base64 enocode php 
Php :: how to change taxonomy slug in wordpress 
Php :: php add item to array 
Php :: laravel observer check if field changed 
Php :: password encryption php 
Php :: validation in laravel 
Php :: array find php 
Php :: get post php 
Php :: php array sort by key value 
Php :: subtract string php 
Php :: update user role wordpress 
Php :: laravel rename table 
Php :: php switch case default 
Php :: factory laravel 
Php :: php www to non www redirect 
Php :: Readonly Properties - PHP 8.1 
Php :: laravel db insert get last id 
Php :: php remove string from array 
Php :: Artisan command on live server 
Php :: encrypt/decrypt data php 
Php :: redirect 404 in laravel 
Php :: php is defined 
Php :: how to change php version in cpanel 
Php :: Convert a String to a Number in PHP 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =