Skip to content
Chung Leong edited this page Jan 10, 2022 · 4 revisions

sign - Sign of a number

float sign( float $x )

sign() returns 1.0 if $x > 0, 0.0 if $x = 0, or –1.0 if $x < 0.

Parameters:

x - The number to process. It can be a scalar or an array.

Return Value:

-1, 0, or 1 depending on whether x is negative, zero, or positive. If x is an array, the return value will also be an array.

Version

1.0 and above.

Clone this wiki locally