PHP.nl

abs

abs

Absolute value

 **abs**  $num

Returns the absolute value of . num

numThe numeric value to process

The absolute value of . If the argument is of type , the return type is also , otherwise it is (as usually has a bigger value range than ). num``num``float``float``int``float``int

Voorbeeld: example

<?php
var_dump(abs(-4.2));
var_dump(abs(5));
var_dump(abs(-5));
?>
float(4.2)
int(5)
int(5)

gmp_abs``gmp_sign