PHP abs() 함수
예시
다른 숫자의 절대값을 반환합니다.
<?php
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>
정의 및 사용
abs() 함수는 숫자의 절대(양수) 값을 반환합니다.
통사론
abs(number);
매개변수 값
Parameter | Description |
---|---|
number | Required. Specifies a number. If the number is of type float, the return type is also float, otherwise it is integer |
기술적 세부 사항
반환 값: | 숫자의 절대값 |
---|---|
반환 유형: | 부동 소수점 / 정수 |
PHP 버전: | 4+ |
❮ PHP 수학 참조